From 13ed0733cc592d22d6f9790c5ea8ea9b94635ecf Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Fri, 3 Dec 2021 22:13:53 +0300 Subject: [PATCH 01/18] Chapter 0 --- coq/ch0.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/coq/ch0.v b/coq/ch0.v index 5a54b230..2f3bc163 100644 --- a/coq/ch0.v +++ b/coq/ch0.v @@ -8,3 +8,8 @@ rewrite big_nat_recr //= IHn addnC -divnMDl //. by rewrite mulnS muln1 -addnA -mulSn -mulnS. Qed. +(* Recommended headers *) +(* From mathcomp Require Import all_ssreflect. *) +(* Set Implicit Arguments. *) +(* Unset Strict Implicit. *) +(* Unset Printing Implicit Defensive. *) From 3bfadec70d397537d69c57d12aeaa8915f7c225c Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Fri, 3 Dec 2021 22:17:00 +0300 Subject: [PATCH 02/18] Chapter 1 --- coq/ch1.v | 271 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 216 insertions(+), 55 deletions(-) diff --git a/coq/ch1.v b/coq/ch1.v index 87c55815..7e605930 100644 --- a/coq/ch1.v +++ b/coq/ch1.v @@ -3,8 +3,13 @@ From mathcomp Require Import all_ssreflect. Set Implicit Arguments. Unset Strict Implicit. -(* functions *) -Definition f := fun n => n + 1. +(* 1.1 Functions *) +(* 1.1.1 Defining functions, performing computation *) + +Definition f1 := fun n => n + 1. +Definition f2 n := n + 1. +Definition f (n : nat) : nat := n + 1. + About f. Print f. Locate "_ ^~ _". @@ -12,81 +17,179 @@ Check f 3. Fail Check f (fun x : nat => x). Eval compute in f 3. + +(* 1.1.2 Functions with several arguments *) + +Definition g' (n : nat) (m : nat) : nat := n + m * 2. +Definition g (n m : nat ) : nat := n + m * 2. + +About g. + +Definition h (n : nat) : nat -> nat := fun m => n + m * 2. + +About h. + +Print g. +Print h. + +Check g 3. +Compute g 2 3. + + +(* 1.1.3 Higher-order functions *) + Definition repeat_twice (g : nat -> nat) : nat -> nat := fun x => g (g x). Eval compute in repeat_twice f 2. Check (repeat_twice f). Fail Check (repeat_twice f f). -(* data *) + +(* 1.1.4 Local definitions *) + +Compute + let n := 33 : nat in + let e := n + n + n in + e + e + e. + + +(* 1.2 Data types, first examples *) +(* 1.2.1 Boolean values *) + +(* This definition is already imported *) +(* Inductive bool := true | false. *) + Check true. -Definition f23 b := if b then 2 else 3. -Eval compute in f23 true. -Eval compute in f23 false. -Definition andb b1 b2 := if b1 then b2 else false. + +Definition twoVthree (b : bool) := if b then 2 else 3. + +Eval compute in twoVthree true. +Eval compute in twoVthree false. + +Definition andb (b1 b2 : bool) := if b1 then b2 else false. +Definition orb (b1 b2 : bool) := if b1 then true else b2. + + +(* 1.2.2 Natural Numbers *) +(* Inductive nat := O | S (n : nat). *) Check fun x => f x.+1. + +Definition non_zero n := if n is p.+1 then true else false. + +Compute non_zero 5. + Locate ".+4". -Definition pred n := if n is u.+1 then u else n. -Definition pred5 n := - if n is u.+1.+1.+1.+1.+1 then u else 0. + +Definition pred n := if n is u.+1 then u else O. + +Definition larger_then_4 n := + if n is u.+1.+1.+1.+1.+1 then true else false. + Definition three_patterns n := match n with u.+1.+1.+1.+1.+1 => u | v.+1 => v | 0 => n end. + Fail Definition wrong (n : nat) := match n with 0 => true end. + Definition same_bool b1 b2 := match b1, b2 with | true, true => true + | false, false => true | _, _ => false end. + Definition same_bool2 b1 b2 := match b1 with | true => match b2 with true => true | _ => false end - | _ => false + | false => match b2 with true => false | _ => true end end. -(* recursion *) + +(* 1.2.3 Recursion on natural numbers *) + Fixpoint addn n m := if n is p.+1 then (addn p m).+1 else m. + Fixpoint addn2 n m := match n with | 0 => m | p.+1 => (addn2 p m).+1 end. + Fail Fixpoint loop n := if n is 0 then loop n else 0. + Fixpoint subn m n : nat := match m, n with | p.+1, q.+1 => subn p q | _ , _ => m end. + Fixpoint eqn m n := match m, n with | 0, 0 => true | p.+1, q.+1 => eqn p q | _, _ => false end. + Notation "x == y" := (eqn x y). -(* containers *) +Compute O == O. +Compute 1 == S O. +Compute 1 == O.+1. +Compute 2 == S O. +Compute 2 == 1.+1. +Compute 2 == addn 1 O.+1. + +Definition leq m n := m - n == 0. +Notation "m <= n" := (leq m n). + + +(* 1.3 Containers *) + +Inductive listn : Set := niln | consn (hd : nat) (tl : listn). + +Check consn 1 (consn 2 niln). + +Inductive testbool : Set := ttrue | tfalse. + +Fail Check consn ttrue (consn tfalse niln). + +Inductive listb := nilb | consb (hd : testbool) (tl : listb). + + +(* 1.3.1 The polymorphic sequence data type *) + +(* This definition is already imported. *) +(* Inductive seq (A : Type) := nil | cons (hd : A) (tl : seq A). *) + About cons. Check cons 2 nil. Check 1 :: 2 :: 3 :: nil. Check fun l => 1 :: 2 :: 3 :: l. -Definition first_element_or_0 (s : seq nat) := - if s is a :: _ then a else 0. + +Definition head T (x0 : T) (s : seq T) := if s is x :: _ then x else x0. + + +(* 1.3.2 Recursion for sequences *) Fixpoint size A (s : seq A) := if s is _ :: tl then (size tl).+1 else 0. + Fixpoint map A B (f : A -> B) s := if s is e :: tl then f e :: map f tl else nil. + +Notation "[ 'seq' E | i <- s ]" := (map (fun i => E) s). + Eval compute in [seq i.+1 | i <- [:: 2; 3]]. -Check (3, false). -Eval compute in (true, false).1. + +(* This definition is already imported *) +(* Inductive option A := None | Some (a : A). *) Definition only_odd (n : nat) : option nat := if odd n then Some n else None. @@ -94,50 +197,117 @@ Definition only_odd (n : nat) : option nat := Definition ohead (A : Type) (s : seq A) := if s is x :: _ then Some x else None. -(* section *) +Inductive pair (A B : Type) : Type := mk_pair (a : A) (b : B). + +(* These definitions are already imported *) +(* Notation "( a , b )" := (mk_pair a b). *) +(* Notation "A * B" := (pair A B). *) +(* Definition fst A B (p : pair A B) := *) +(* match p with mk_pair x _ => x end. *) + +Check (3, false). +Compute (true, false).1. + + +(* 1.1.4 Aggregating data in record types *) + +Record point : Type := Point { x : nat; y : nat; z : nat }. + +Compute x (Point 3 0 2). +Compute y (Point 3 0 2). + + +(* 1.4 The Section mechanism *) + Section iterators. - Variables (T : Type) (A : Type). - Variables (f : T -> A -> A). - Implicit Type x : T. - Fixpoint iter n op x := - if n is p.+1 then op (iter p op x) else x. - Fixpoint foldr a s := - if s is x :: xs then f x (foldr a xs) else a. - About foldr. - Variable init : A. - Variables x1 x2 x3 : T. - Eval compute in foldr init [:: x1; x2; x3]. + + Variables (T : Type) (A : Type). + Variables (f : T -> A -> A). + + Implicit Type x : T. + + Fixpoint iter n op x := + if n is p.+1 then op (iter p op x) else x. + + Fixpoint foldr a s := + if s is x :: xs then f x (foldr a xs) else a. + + About foldr. + End iterators. -About iter. + About foldr. -Eval compute in iter 5 pred 7. -Eval compute in foldr addn 0 [:: 1; 2; 3]. -Fixpoint addn_alt m n := if m is u.+1 then addn_alt u n.+1 else n. -Section symbolic. + +Eval compute in iter 5 predn 7. +Eval compute in foldr addn 0 [:: 1; 2 ]. + + +(* 1.5 Symbolic computation *) + +Section iterators_symbolic. + + Variables (T : Type) (A : Type). + Variables (f : T -> A -> A). + + Fixpoint foldr' a s := + if s is x :: xs then f x (foldr' a xs) else a. + + About foldr'. + + Variable init : A. + Variables x1 x2 : T. + Compute foldr' init [:: x1; x2]. + + Compute addn 1 (addn 2 0). + + (* already defined *) + (* Fixpoint addn n m := if n is p.+1 then (addn p m).+1 else m. *) + + Fixpoint add n m := if n is p.+1 then add p m.+1 else m. + Variable n : nat. - Eval simpl in pred (addn_alt n.+1 7). - Eval simpl in pred (addn n.+1 7). -End symbolic. + Eval simpl in predn (add n.+1 7). + Eval simpl in predn (addn n.+1 7). + +End iterators_symbolic. + + +(* 1.6 Iterators and mathematical notations *) -(* iterated ops *) Fixpoint iota m n := if n is u.+1 then m :: iota m.+1 u else [::]. Notation "\sum_ ( m <= i < n ) F" := (foldr (fun i a => F + a) 0 (iota m (n-m))). + Eval compute in \sum_( 1 <= i < 5 ) (i * 2 - 1). Eval compute in \sum_( 1 <= i < 5 ) i. -(* aggregated data *) -Record point := Point { x : nat; y : nat; z : nat }. -Eval compute in x (Point 3 0 2). -Eval compute in y (Point 3 0 2). -(** Exercises *************************************** *) +(* 1.7 Notations, abbreviations *) +Notation "m + n" := (addn m n) (at level 50, left associativity). +Notation "m <= n" := (leq m n) (at level 70, no associativity). +Notation "m < n" := (m.+1 <= n). +Notation "n > m" := (m.+1 <= n) (only parsing). +Notation succn := S. +Notation "n .+1" := (succn n) (at level 2, left associativity): nat_scope. -Module exercises. -(* pair *) +Locate "<=". + +(* all_words, we will face later in the book *) + +Definition all_words n T (alphabet : seq T) := + let prepend x wl := [seq x :: w | w <- wl] in + let extend wl := flatten [seq prepend x wl | x <- alphabet] in + iter n extend [::[::]]. + +Eval compute in all_words 2 [:: 1; 2; 3]. +(******** Code below is not in the book already ********) +(** Exercises *************************************** *) + +Module exercises. + (* pair *) Eval compute in fst (4,5). @@ -171,13 +341,4 @@ Definition flatten T (s : seq (seq T)) := foldr cat [::] s. Eval compute in flatten [:: [:: 1; 2; 3]; [:: 4; 5] ]. - -(* all_words *) -Definition all_words n T (alphabet : seq T) := - let prepend x wl := [seq x :: w | w <- wl] in - let extend wl := flatten [seq prepend x wl | x <- alphabet] in - iter n extend [::[::]]. - -Eval compute in all_words 2 [:: 1; 2; 3]. - -End exercises. \ No newline at end of file +End exercises. From b702c279e6aed1344284578371ed672c433fc270 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sat, 4 Dec 2021 22:45:35 +0300 Subject: [PATCH 03/18] Chapter 2 --- coq/ch2.v | 323 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 252 insertions(+), 71 deletions(-) diff --git a/coq/ch2.v b/coq/ch2.v index 9fbe5c48..ad0c4978 100644 --- a/coq/ch2.v +++ b/coq/ch2.v @@ -1,123 +1,280 @@ From mathcomp Require Import all_ssreflect. -(* statements *) + +(* 2.1.1 Ground equalities *) + Check 3 = 3. Check false || true = true. + Locate "=". About eq. + Fail Check 3 = [:: 3]. -(* proofs *) Lemma my_first_lemma : 3 = 3. +Proof. Admitted. + +About my_first_lemma. + + +(* 2.1.2 Identities *) + +(* Lemma addnA (m n k : nat) : m + (n + k) = m + n + k. Admitted. *) +(* Lemma addnA m n k : m + (n + k) = m + n + k. Admitted. *) +(* Lemma orbT b : b || true = true. Admitted. *) + +(* Lemma orbA b1 b2 b3 : b1 || (b2 || b3) = b1 || b2 || b3. Admitted. *) +(* Lemma implybE a b : (a ==> b) = ~~ a || b. Admitted. *) +(* Lemma negb_and (a b : bool) : ~~ (a && b) = ~~ a || ~~ b. Admitted. *) + + +(* 2.1.3 From boolean predicates to formal statements *) + +(* Lemma leq0n (n : nat) : 0 <= n = true. Admitted. *) +(* Lemma leq0n (n : nat) : 0 <= n. Admitted. *) + +(* Lemma eqn_leq m n : (m == n) = (m <= n) && (n <= m). Admitted. *) +(* Lemma neq_ltn m n : (m != n) = (m < n) || (n < m). Admitted. *) +(* Lemma leqn0' n : (n <= 0) = (n == 0). Admitted. *) +(* Lemma dvdn1 d : (d %| 1) = (d == 1). Admitted. *) +(* Lemma odd_mul m n : odd (m * n) = odd m && odd n. Admitted. *) + +(* Lemma leq_pmull m n : n > 0 -> m <= n * m. Admitted. *) +(* Lemma odd_gt0 n : odd n -> n > 0. Admitted. *) + +(* Lemma dvdn_mul d1 d2 m1 m2 : d1 %| m1 -> d2 %| m2 -> d1 * d2 %| m1 * m2. Admitted. *) + + +(* 2.2 Formal proofs *) + +Lemma my_first_lemma' : 3 = 3. +Proof. Admitted. + + +(* 2.2.1 Proofs by computation *) + +Lemma my_first_lemma'' : 3 = 3. Proof. by []. Qed. + +About my_first_lemma''. + Lemma my_second_lemma : 2 + 1 = 3. Proof. by []. Qed. + Lemma addSn m n : m.+1 + n = (m + n).+1. Proof. by []. Qed. + +(* 2.2.2 Case analisys *) + +Definition negb (b : bool) : bool := if b then false else true. + Lemma negbK b : ~~ (~~ b) = b. Proof. by case: b. Qed. Lemma leqn0 n : (n <= 0) = (n == 0). Proof. by case: n => [| k]. Qed. +Fixpoint muln (m n : nat) : nat := + if m is p.+1 then n + muln p n else 0. + + +(* 2.2.3 Rewriting *) + Lemma muln_eq0 m n : (m * n == 0) = (m == 0) || (n == 0). Proof. -case: m => [|m] //. -case: n => [|k] //. -by rewrite muln0. + case: m => [|m] //. + case: n => [|k] //. + by rewrite muln0. Qed. Lemma leqE m n : (m <= n) = (m - n == 0). -Admitted. -Lemma leq_mul2l m n1 n2 : (m * n1 <= m * n2) = (m == 0) || (n1 <= n2). +Proof. by []. Qed. + +Lemma leq_mul2l' m n1 n2 : (m * n1 <= m * n2) = (m == 0) || (n1 <= n2). Proof. by rewrite !leqE -mulnBr muln_eq0. Qed. -(* quantifiers *) + +(* 2.3 Quantifiers *) +(* 2.3.1 Univerdal quantification, first examples *) + +About leq. + +Definition leq := fun (n m : nat) => m - n == 0. + +About leqn0. +About muln_eq0. + +Lemma seq_eq_ext (s1 s2 : seq nat) : + size s1 = size s2 -> + (forall i : nat, nth 0 s1 i = nth 0 s2 i) -> + s1 = s2. Admitted. + +Lemma size_map (T1 T2 : Type) : + forall (f : T1 -> T2) (s : seq T1), size (map f s) = size s. Admitted. + +(* This definition is already imported *) +(* Definition commutative (S T : Type) (op : S -> S -> T) := *) +(* forall x y, op x y = op y x. *) + +Lemma addnC : commutative addn. Admitted. + Section StandardPredicates. -Variable T : Type. -Implicit Types (op add : T -> T -> T) (R : rel T). -Definition associative op := forall x y z, op x (op y z) = op (op x y) z. -Definition left_distributive op add := - forall x y z, op (add x y) z = add (op x z) (op y z). -Definition left_id e op := forall x, op e x = x. + Variable T : Type. + + Implicit Types (op add : T -> T -> T). + + Definition associative op := forall x y z, op x (op y z) = op (op x y) z. + Definition left_distributive op add := + forall x y z, op (add x y) z = add (op x z) (op y z). + Definition left_id e op := forall x, op e x = x. End StandardPredicates. Section MoreStandardPredicates. -Variables rT aT : Type. -Implicit Types (f : aT -> rT). -Definition injective f := forall x1 x2, f x1 = f x2 -> x1 = x2. -Definition cancel f g := forall x, g (f x) = x. -Definition pcancel f g := forall x, g (f x) = Some x. + Variables rT aT : Type. + Implicit Types (f : aT -> rT). + Definition injective f := forall x1 x2, f x1 = f x2 -> x1 = x2. + Definition cancel f g := forall x, g (f x) = x. + Definition pcancel f g := forall x, g (f x) = Some x. End MoreStandardPredicates. -Lemma dvdn_fact m n : 0 < m -> m <= n -> m %| n`!. -Proof. by move=> m_gt0 ?; rewrite dvdn_fact ?m_gt0. Qed. +About commutative. -Lemma example m p : prime p -> - p %| m `! + 1 -> m < p. -Proof. -move=> prime_p. -apply: contraLR. -rewrite -leqNgt. -move=> leq_p_m. -rewrite dvdn_addr. - rewrite gtnNdvd. -About contraLR. - by []. (* ~~ false *) - by []. (* 0 < 1 *) - by apply: prime_gt1. (* 1 < p *) -apply: dvdn_fact. - by apply: prime_gt0. (* 0 < p *) -by []. (* p <= m *) -Qed. +Check 3 = 3. +Check (commutative addn). + +(* 2.3.2 Organizing proofs with sections *) + +Section Chinese. + + Variables m1 m2 : nat. + Hypothesis co_m12 : coprime m1 m2. + + Lemma chinese_remainder x y : + (x == y %[mod m1 * m2]) = (x == y %[mod m1]) && (x == y %[mod m2]). + Proof. Admitted. + +End Chinese. + +About chinese_remainder. + + +(* 2.3.3 Using lemmas in proofs *) + +Lemma leqnn n : n <= n. Proof. Admitted. + +Lemma example a b : a + b <= a + b. +Proof. by apply: leqnn. Qed. + +Lemma example1 a b : a.+1 + b <= (a + b).+1. +Proof. by apply: leqnn. Qed. -Lemma example1 m p : prime p -> - p %| m `! + 1 -> ~~ (p <= m). +(* This line belongs to the file where leqnn is stated and proved.*) +Hint Resolve leqnn. +Lemma example2 a b : a + b <= a + b. +Proof. by []. Qed. + +(* Lemma contraLR (c b : bool) : (~~ c -> ~~ b) -> (b -> c). *) +(* Lemma dvdn_addr m d n : d %| m -> (d %| m + n) = (d %| n). *) +(* Lemma dvdn_fact m n : 0 < m <= n -> m %| n ` !. *) +(* Lemma prime_gt0 p : prime p -> 0 < p. *) +(* Lemma gtnNdvd n d : 0 < n -> n < d -> (d %| n) = false. *) +(* Lemma prime_gt1 p : prime p -> 1 < p. *) + +Lemma example3 m p : prime p -> p %| m `! + 1 -> m < p. Proof. -move=> prime_p; apply: contraL; move=> leq_p_m. -rewrite dvdn_addr. - by rewrite gtnNdvd // prime_gt1. -by rewrite dvdn_fact // prime_gt0. + move=> prime_p. + apply: contraLR. + rewrite -leqNgt. + move=> leq_p_m. + rewrite dvdn_addr. + rewrite gtnNdvd. + by []. (* ~~ false *) + by []. (* 0 < 1 *) + by apply: prime_gt1. (* 1 < p *) + apply: dvdn_fact. + rewrite prime_gt0. (* 0 < p <= n *) + by []. (* true && p <= m *) + by []. (* prime p *) Qed. -Lemma example2 m p : prime p -> - p %| m `! + 1 -> ~~ (p <= m). +Lemma example3' m p : prime p -> p %| m `! + 1 -> m < p. Proof. -move=> prime_p; apply: contraL; move=> leq_p_m. -rewrite dvdn_addr. - by rewrite gtnNdvd // prime_gt1. -by rewrite dvdn_fact // prime_gt0. + move=> prime_p; apply: contraLR; rewrite -leqNgt; move=> leq_p_m. + rewrite dvdn_addr. + by rewrite gtnNdvd // prime_gt1. + by rewrite dvdn_fact // prime_gt0. Qed. + +(* 2.3.4 Proofs by induction *) + +About nat_ind. + +About list_ind. + +About last_ind. + +About foldl. +Print foldl. + +(* Lemma last_ind A (P : list A -> Prop) : *) +(* P [::] -> (forall s x, P s -> P (rcons s x)) -> forall s, P s. *) + +(* Fixpoint foldl T R (f : R -> T -> R) z s := *) +(* if s is x :: s' then foldl f (f z x) s' else z. *) + +(* Lemma cats1 T s (z : T) : s ++ [:: z] = rcons s z. *) + +(* Lemma foldr_cat T R f (z0 : R) (s1 s2 : seq T) : *) +(* foldr f z0 (s1 ++ s2) = foldr f (foldr f z0 s2) s1. *) + +(* Lemma rev_rcons T s (x : T) : rev (rcons s x) = x :: rev s. *) + Lemma foldl_rev T A f (z : A) (s : seq T) : - foldl f z (rev s) = foldr (fun x z => f z x) z s . +foldl f z (rev s) = foldr (fun x z => f z x) z s . Proof. -elim/last_ind: s z => [|s x IHs] z //. -by rewrite -cats1 foldr_cat -IHs cats1 rev_rcons. + elim/last_ind: s z => [|s x IHs] z //. + by rewrite -cats1 foldr_cat -IHs cats1 rev_rcons. Qed. -(** Exercises *) -Lemma orbA b1 b2 b3 : b1 || (b2 || b3) = b1 || b2 || b3. -Proof. by case: b1; case: b2; case: b3. Qed. -Lemma implybE a b : (a ==> b) = ~~ a || b. -Proof. by case: a; case: b. Qed. -Lemma negb_and (a b : bool) : ~~ (a && b) = ~~ a || ~~ b. -Proof. by case: a; case: b. Qed. +(* 2.4 Rewrite, a Swiss army knife *) +Lemma example3'' m p : prime p -> p %| m `! + 1 -> m < p. +Proof. + move=> prime_p; apply: contraLR; rewrite -leqNgt => leq_p_m. + rewrite dvdn_addr ?dvdn_fact ?prime_gt0 //. + by rewrite gtnNdvd // prime_gt1. +Qed. -Lemma subn_sqr m n : m ^ 2 - n ^ 2 = (m - n) * (m + n). -Proof. by rewrite mulnBl !mulnDr addnC [m * _]mulnC subnDl !mulnn. Qed. +Lemma silly_example n : n + 0 = (n + 0) + 0. +Proof. by rewrite [in RHS]addn0. Qed. +Lemma simplify_me : size [:: true] = 1. +Proof. by rewrite /=. Qed. -Lemma odd_exp m n : odd (m ^ n) = (n == 0) || odd m. + +(* 2.4.1 Rewrite contextual patterns *) + +Lemma leq_mul2l m n1 n2 : (m * n1 <= m * n2) = (m == 0) || (n1 <= n2). Proof. -elim: n => // n IHn. -rewrite expnS odd_mul {}IHn orbC. -by case: odd. -Qed. + (* rewrite [n1 <= _]leqE. *) + (* rewrite -mulnBr. *) + rewrite [in RHS]leqE. + rewrite -[_ || _]muln_eq0. + rewrite -[n1]/(0 + n1). + rewrite [in LHS]/ssrnat.leq. +Admitted. + +(* 2.5 Searching the library *) + +Search (odd _). +Search eq odd -coprime. + +(* We will need all_words and size_all_words at the end of the book *) + Definition all_words n T (alphabet : seq T) := let prepend x wl := [seq x :: w | w <- wl] in let extend wl := flatten [seq prepend x wl | x <- alphabet] in @@ -128,8 +285,32 @@ Arguments all_words _ [T] _. Lemma size_all_words n T (alphabet : seq T) : size (all_words n alphabet) = size alphabet ^ n. Proof. -elim: n => [|n IHn]; first by rewrite expn0. -rewrite expnS -{}IHn [in LHS]/all_words iterS -/(all_words _ _). -elim: alphabet (all_words _ _) => //= w ws IHws aw. -by rewrite size_cat IHws size_map mulSn. + elim: n => [|n IHn]; first by rewrite expn0. + rewrite expnS -{}IHn [in LHS]/all_words iterS -/(all_words _ _). + elim: alphabet (all_words _ _) => //= w ws IHws aw. + by rewrite size_cat IHws size_map mulSn. +Qed. + + +(******** Code below is not in the book already ********) + +(** Exercises *) + +Lemma orbA b1 b2 b3 : b1 || (b2 || b3) = b1 || b2 || b3. +Proof. by case: b1; case: b2; case: b3. Qed. + +Lemma implybE a b : (a ==> b) = ~~ a || b. +Proof. by case: a; case: b. Qed. + +Lemma negb_and (a b : bool) : ~~ (a && b) = ~~ a || ~~ b. +Proof. by case: a; case: b. Qed. + +Lemma subn_sqr m n : m ^ 2 - n ^ 2 = (m - n) * (m + n). +Proof. by rewrite mulnBl !mulnDr addnC [m * _]mulnC subnDl !mulnn. Qed. + +Lemma odd_exp m n : odd (m ^ n) = (n == 0) || odd m. +Proof. + elim: n => // n IHn. + rewrite expnS odd_mul {}IHn orbC. + by case: odd. Qed. From 23b8a8d480e422a8a2704b0a1f10e5e14e892a5e Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sat, 4 Dec 2021 22:52:13 +0300 Subject: [PATCH 04/18] Update README.md --- coq/README.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/coq/README.md b/coq/README.md index 9ca4710f..70f0804a 100644 --- a/coq/README.md +++ b/coq/README.md @@ -1,14 +1,19 @@ # The Mathematical Components book code listings for jsCoq. -Code snippets are intended to be viewed using jsCoq (actual version is -here), but you also can just -open selected `.v` file in your favorite Galina code editor. To view pages in -your browser locally you need install `coq`, `mathcomp`, then do `npm install` -and `node app.js` to run node applicaion (app.js) and then open link -http://127.0.0.1:8010/ in your browser. A bit more detailed instructions are +You can view jscoq snippets here +just by open link in browser. Or it is possible to download and open usual .v file in +your favorite Galina editor. + +Instructions below are given to view code snippets on localhost (mostly +for testing/developement purposes). + +Code snippets are intended to be viewed using jsCoq for usability (is by the link above). +To view pages in your browser locally you need install `coq`, `mathcomp`, +then do `npm install` and `node app.js` to run node applicaion (app.js) and then open +link http://127.0.0.1:8010/ in your browser. A bit more detailed instructions are provided below. -You can view jscoq snippets here. + ## Installation & Run From 08f45120323135f3ff7a99805accfaecdb5f9ad7 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sat, 4 Dec 2021 23:07:02 +0300 Subject: [PATCH 05/18] Update README.md --- coq/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coq/README.md b/coq/README.md index 70f0804a..6c415bbc 100644 --- a/coq/README.md +++ b/coq/README.md @@ -1,6 +1,6 @@ # The Mathematical Components book code listings for jsCoq. -You can view jscoq snippets here +You can view jscoq snippets here just by open link in browser. Or it is possible to download and open usual .v file in your favorite Galina editor. From 08416a0cef00ed14422904cdd4fa4d1c4b3d6993 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sat, 4 Dec 2021 23:09:12 +0300 Subject: [PATCH 06/18] Update README.md --- coq/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/coq/README.md b/coq/README.md index 6c415bbc..f6a2f362 100644 --- a/coq/README.md +++ b/coq/README.md @@ -7,11 +7,11 @@ your favorite Galina editor. Instructions below are given to view code snippets on localhost (mostly for testing/developement purposes). -Code snippets are intended to be viewed using jsCoq for usability (is by the link above). -To view pages in your browser locally you need install `coq`, `mathcomp`, -then do `npm install` and `node app.js` to run node applicaion (app.js) and then open -link http://127.0.0.1:8010/ in your browser. A bit more detailed instructions are -provided below. +Code snippets are intended to be viewed using jsCoq for usability (and can be found +by the link above). To view pages in your browser locally you need install `coq`, +`mathcomp`, then do `npm install` and `node app.js` to run node applicaion (app.js) +and then open link http://127.0.0.1:8010/ in your browser. A bit more detailed +instructions are provided below. From 115cd96ad1fcae15fd28fdf0bc22604e29292c15 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sun, 5 Dec 2021 01:02:36 +0300 Subject: [PATCH 07/18] minor ch1 rewording --- coq/ch1.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coq/ch1.v b/coq/ch1.v index 7e605930..b94412ae 100644 --- a/coq/ch1.v +++ b/coq/ch1.v @@ -302,7 +302,8 @@ Definition all_words n T (alphabet : seq T) := Eval compute in all_words 2 [:: 1; 2; 3]. -(******** Code below is not in the book already ********) +(* Code below is not anymore in the book and given here for *) +(* additional examples. *) (** Exercises *************************************** *) From ba5f49dec7ee4569e507a12bebcd40d344f8b20f Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sun, 5 Dec 2021 01:02:44 +0300 Subject: [PATCH 08/18] minor ch2 rewording --- coq/ch2.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coq/ch2.v b/coq/ch2.v index ad0c4978..69102e85 100644 --- a/coq/ch2.v +++ b/coq/ch2.v @@ -294,6 +294,9 @@ Qed. (******** Code below is not in the book already ********) +(* Code below is not anymore in the book and given here for *) +(* additional examples. *) + (** Exercises *) Lemma orbA b1 b2 b3 : b1 || (b2 || b3) = b1 || b2 || b3. From abdbe8cb56d1657c6ababc1e3f55a705a94aea8f Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sun, 5 Dec 2021 01:02:57 +0300 Subject: [PATCH 09/18] Chapter 3 --- coq/ch3.v | 185 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 167 insertions(+), 18 deletions(-) diff --git a/coq/ch3.v b/coq/ch3.v index d79cdb91..4d89c0ff 100644 --- a/coq/ch3.v +++ b/coq/ch3.v @@ -1,6 +1,8 @@ From mathcomp Require Import all_ssreflect. +(* 3.1 Propositions as types, proofs as programs *) + Check 3 : nat. Section CheckNat. @@ -14,7 +16,167 @@ Check muln0 n : n * 0 = 0. End CheckNat. -Check Prop. +(* 3.2 Terms, types, sorts *) + +Check 7 = 7 : Prop. +Check 7 = 9 : Prop. +Check nat : Set. + +Set Printing Universes. + +Check Type : Type. +Check Prop : Type. +Check Set : Type. + +(* This definition is already imported. *) +(* Inductive seq (A : Type) := nil | cons (hd : A) (tl : seq A). *) + +Check seq. + +Variables (n m : nat) (l : seq nat). + +Hypothesis neq0 : n = 0. +(* Variable neq0 : n = 0. *) +Variable t : nat -> Type. + +Variable g : forall n : nat, t n. + +Check forall x : nat, bool : Type. + +Variable f : nat -> bool. + +Check f 3 : bool. + +Inductive testbool := ttrue | tfalse. + +Fail Check f ttrue : bool. + +Variable g' : forall n, t n. +Check g' 3 : t 3. + +Definition bar (n : nat) : bool := n == 0. + +Check bar : nat -> bool. + +Definition bar' (n : nat) : nat := n. +Print bar'. +Print id. +Compute bar' 4. + + +(* 3.3 Propositions, implication, universal quantification *) + +Lemma modus_ponens (A B : Prop) : (A -> B) -> A -> B. +Proof. + move=> hAB hA. + apply: hAB. + exact: hA. +Qed. + +Lemma modus_ponens' (A B : Prop) : (A -> B) -> A -> B. +Proof. + move=> hAB hA. + exact: (hAB hA). +Qed. + +Lemma modus_ponens'' (A B : Prop) : (A -> B) -> A -> B. +Proof. + exact: (fun hAB hA => hAB hA). +Qed. + + +(* 3.5 Inductive types *) + +(* This definition is already imported. *) +(* Inductive nat : Set := O : nat | S (n : nat). *) + +Unset Printing Notations. +Variable n' : nat. + +Check O. +Check S O. +Check S (S (S O)). +Check S (S (S n')). + +Definition non_zero n := if n is (S p) then true else false. + +Fixpoint addn n m := + match n with + | 0 => m + | S p => S (addn p m) + end. + + +(* 3.6 More connectives *) + +(* These definitions are already imported. *) +(* Inductive and (A B : Prop) : Prop := conj (pa : A) (pb : B). *) +(* Notation "A /\ B" := (and A B). *) + +(* Inductive prod (A B : Type) := pair (a : A) (b : B). *) + +Definition proj1 A B (p : A /\ B) : A := + match p with conj a _ => a end. + +About conj. + +(* These definitions are already imported. *) +(* Inductive ex (A : Type) (P : A -> Prop) : Prop := *) +(* ex_intro (x : A) (p : P x). *) +(* Notation "'exists' x : A , p" := (ex A (fun x : A => p)) (at level 200). *) + +Inductive or (A B : Prop) : Prop := or_introl (a : A) | or_intror (b : B). +Notation "A \/ B" := (or A B). + +Print or_ind. + +(* Definition or_ind (A B P : Prop) *) +(* (aob : A \/ B) (pa : A -> P) (pb : B -> P) : P := *) +(* match aob with or_introl a => pa a | or_intror b => pb b end. *) + +Inductive True : Prop := I. +Inductive False : Prop := . +Definition not (A : Prop) := A -> False. +Notation "~ A" := (not A). + +Definition exfalso (P : Prop) (f : False) : P := + match f with end. (* no constructors, no branches *) + +Inductive eq (A:Type) (x:A) : A -> Prop := erefl : eq A x x. +Notation "x = y" := (@eq _ x y). + +Print eq_ind. + +(* Definition eq_ind A (P : A -> Prop) x (px : P x) y (e : x = y) : P y := *) +(* match e with erefl => px end. *) + +About nat_ind. + +Fixpoint nat_ind (P : nat -> Prop) + (p0 : P 0) (pS : forall n : nat, P n -> P n.+1) n : P n := + if n is m.+1 then + let pm (* : P m *) := nat_ind P p0 pS m in + pS m pm (* : P m.+1 *) + else p0. + +Lemma strong_nat_ind (P : nat -> Prop) + (base : P 0) + (step : forall n, (forall m, m <= n -> P m) -> P n.+1) x : P x. + Check (nat_ind (fun n => forall m, m <= n -> P m)). + Proof. + apply: (nat_ind (fun n => forall m, m <= n -> P m) _ _ x x (leqnn x)). + Admitted. + +Fail Fixpoint oops (n : nat) : False := oops n. +Fail Check oops 3. (* : False *) + +Fail Inductive hidden := Hide (f : hidden -> False). +Fail Definition oops (hf : hidden) : False := let: Hide f := hf in f hf. +Fail Check oops (Hide oops). (* : False *) + + +(* Definitions below are not anymore in the book and given here as *) +(* additional examples. *) Lemma stamps n : 12 <= n -> exists s4 s5, s4 * 4 + s5 * 5 = n. Proof. @@ -29,16 +191,8 @@ case: (IHn ((16+m) - 4) _ isT) => [|s4 [s5 def_m4]]. by exists s4.+1, s5; rewrite mulSn -addnA def_m4 subnKC. Qed. - -Fixpoint nat_ind (P : nat -> Prop) - (p0 : P 0) (pS : forall n : nat, P n -> P n.+1) n : P n := - if n is m.+1 then - let pm (* : P m *) := nat_ind P p0 pS m in - pS m pm (* : P m.+1 *) - else p0. - Lemma absurd : false = true -> forall P, P. -Proof. by []. Qed. (* see coqart? *) +Proof. by []. Qed. Definition leq_trans n m o (Hmn : m <= n) (Hno : n <= o) : m <= o := nat_ind (fun n => forall m o, m <= n -> n <= o -> m <= o) @@ -58,7 +212,7 @@ Definition leq_trans n m o (Hmn : m <= n) (Hno : n <= o) : m <= o := n m o Hmn Hno. -Definition strong_nat_ind (P : nat -> Prop) +Definition strong_nat_ind' (P : nat -> Prop) (base : P 0) (step : forall n, (forall m, m <= n -> P m) -> P n.+1) n : P n := @@ -80,12 +234,7 @@ Definition strong_nat_ind (P : nat -> Prop) Axiom P : nat -> Prop. Check (nat_ind (fun n => forall m, m <= n -> P m)). -(* -: (forall m : nat, m <= 0 -> P m) -> -(forall n : nat, - (forall m : nat, m <= n -> P m) -> forall m : nat, m <= n.+1 -> P m) -> -forall n m : nat, m <= n -> P m -*) + Lemma strong_nat_ind2 (P : nat -> Prop) (base : P 0) (step : forall n, (forall m, m <= n -> P m) -> P n.+1) x : P x. @@ -96,4 +245,4 @@ apply: (nat_ind (fun n => forall m, m <= n -> P m) _ _ x x (leqnn x)). move=> n IHn; case=> [_|m Hm]; first by exact: base. apply: step=> j Hjm; apply: IHn. apply: leq_trans Hjm Hm. -Qed. \ No newline at end of file +Qed. From d09ef9aaf19c5c160260304b3c3f30a1c2ec303f Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Sun, 5 Dec 2021 01:07:16 +0300 Subject: [PATCH 10/18] minor ch3 rewording --- coq/ch3.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coq/ch3.v b/coq/ch3.v index 4d89c0ff..9e0fbf4d 100644 --- a/coq/ch3.v +++ b/coq/ch3.v @@ -175,8 +175,8 @@ Fail Definition oops (hf : hidden) : False := let: Hide f := hf in f hf. Fail Check oops (Hide oops). (* : False *) -(* Definitions below are not anymore in the book and given here as *) -(* additional examples. *) +(* Code below is not in the book anymore and given here as *) +(* additional examples. *) Lemma stamps n : 12 <= n -> exists s4 s5, s4 * 4 + s5 * 5 = n. Proof. From 7178c4d3bc2eccf733645abc8dd0a501b7af55d5 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Mon, 6 Dec 2021 00:40:44 +0300 Subject: [PATCH 11/18] ongoing --- coq/ch4.v | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/coq/ch4.v b/coq/ch4.v index d628b2b2..84bf39e7 100644 --- a/coq/ch4.v +++ b/coq/ch4.v @@ -1,5 +1,78 @@ From mathcomp Require Import all_ssreflect. + +(* 4.1.1 Pulling from the stack *) +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => xy pr_x odd_y. +Abort. + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] pr_x odd_y. +Abort. + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] /= pr_x odd_y. +Abort. + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] /= /prime_gt1-x_gt1 odd_y. +Abort. + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x [//|z]] /= /prime_gt1-x_gt1. +Abort. + +Print odd. +(* Fixpoint odd n := if n is n'.+1 then ~~ odd n' else false. *) + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + by move=> [x [//|z]] /= /prime_gt1-x_gt1 _; apply: ltn_addl x_gt1. +Qed. + +About ltn_addl. + + +(* 4.1.2 Working on the stack *) + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] /= /prime_gt1. +Abort. + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] /= /prime_gt1/ltnW. +Abort. + +Goal (forall n, n * 2 = n + n) -> 6 = 3 + 3. + move => /(_ 3). +Abort. + +Goal (forall n, n * 2 = n + n) -> 6 = 3 + 3. + move => /(_ 3) <-. +Abort. + + +(* 4.1.3 Pushing to the stack *) + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] /= /prime_gt1-x_gt1 odd_y. + move: y odd_y. + case. +Abort. + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] /= /prime_gt1-x_gt1 odd_y. + case: y odd_y. +Abort. + +Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. + move => [x y] /= /prime_gt1-x_gt1 odd_y. + case: y odd_y => [|y']. +Abort. + + +(* 4.2.1 Primes, a never ending story *) + + Module reflect1. Inductive reflect (P : Prop) b := From 10bb2f272e14ac6c51d41d329f3ede5b0175b01a Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Mon, 6 Dec 2021 10:47:56 +0300 Subject: [PATCH 12/18] Chapter 4 --- coq/ch4.v | 138 ++++++++++++++++++++++-------------------------------- 1 file changed, 57 insertions(+), 81 deletions(-) diff --git a/coq/ch4.v b/coq/ch4.v index 84bf39e7..58dcdfd0 100644 --- a/coq/ch4.v +++ b/coq/ch4.v @@ -72,106 +72,82 @@ Abort. (* 4.2.1 Primes, a never ending story *) +(* Inductive ex2 A P Q : Prop := ex_intro2 x of P x & Q x. *) +(* Notation "exists2 x , p & q" := (ex2 (fun x => p) (fun x => q)). *) + +(* Notation "n ` !" := (factorial n). *) +(* Lemma fact_gt0 n : 0 < n`!. *) +(* Lemma dvdn_fact m n : 0 < m <= n -> m %| n`!. *) +(* Lemma pdivP n : 1 < n -> exists2 p, prime p & p %| n, *) +(* Lemma dvdn_addr m d n : d %| m -> (d %| m + n) = (d %| n). *) +(* Lemma gtnNdvd n d : 0 < n -> n < d -> (d %| n) = false. *) + +Goal forall m, exists2 p, m < p & prime p. + move => m; have m1_gt1 : 1 < m`! + 1. + by rewrite addn1 ltnS fact_gt0. +Abort. -Module reflect1. - -Inductive reflect (P : Prop) b := - | RT (p : P) (e : b) - | RF (p : ~ P) (e : b = false). - -Lemma andP (b1 b2 : bool) : reflect (b1 /\ b2) (b1 && b2). -Proof. -by case: b1; case: b2; [ left | right => //= [[l r]] ..]. -Qed. - -Lemma orP (b1 b2 : bool) : reflect (b1 \/ b2) (b1 || b2). -Proof. -case: b1; case: b2; [ left; by [ move | left | right ] .. |]. -by right=> // [[l|r]]. -Qed. +Goal forall m, exists2 p, m < p & prime p. + move => m; have m1_gt1 : 1 < m`! + 1. + by rewrite addn1 ltnS fact_gt0. + case: (pdivP m1_gt1) => [p pr_p p_dv_m1]. +Abort. -Lemma implyP (b1 b2 : bool) : reflect (b1 -> b2) (b1 ==> b2). +Lemma prime_above m : exists2 p, m < p & prime p. Proof. -by case: b1; case: b2; [ left | right | left ..] => //= /(_ isT). + have /pdivP[p pr_p p_dv_m1]: 1 < m`! + 1. + by rewrite addn1 ltnS fact_gt0. + exists p => //; rewrite ltnNge; apply: contraL p_dv_m1 => p_le_m. + by rewrite dvdn_addr ?dvdn_fact ?prime_gt0 // gtnNdvd ?prime_gt1. Qed. -End reflect1. - -Definition bool_Prop_equiv (P : Prop) (b : bool) := b = true <-> P. - -Lemma test_bool_Prop_equiv b P : bool_Prop_equiv P b -> P \/ ~ P. -Proof. -case: b; case => hlr hrl. - by left; apply: hlr. -by right => hP; move: (hrl hP). -Qed. -Lemma iffP_lr (P : Prop) (b : bool) : - (P -> b) -> (b -> P) -> reflect P b. -Proof. -by move=> *; apply: (iffP idP). -Qed. +(* 4.2.2 Order and max, a matter of symmetry *) -Lemma iffP_rl (P : Prop) (b : bool) : - reflect P b -> ((P -> b) /\ (b -> P)). -Proof. by case: b; case=> p; split. Qed. +(* Lemma orP {a b : bool} : a || b -> a \/ b. *) +(* Lemma orb_idr (a b : bool) : (b -> a) -> (a || b) = a. *) +(* Lemma orbC a b : a || b = b || a. *) +(* Lemma maxn_idPl {m n} : n <= m -> maxn m n = m. *) +(* Lemma maxnC m n : maxn m n = maxn n m. *) +(* Lemma leq_total m n : (m <= n) || (n <= m). *) -Lemma eqnP {n m : nat} : - reflect (n = m) (eqn n m). +Lemma leq_max4 m n1 n2 : (m <= maxn n1 n2) = (m <= n1) || (m <= n2). Proof. -apply: (iffP idP) => [|->]; last by elim: m. -by elim: n m => [[]|n IH [//|m] /IH ->]. + case: (orP (leq_total n2 n1)) => [le_n21|le_n12]. + rewrite (maxn_idPl le_n21) orb_idr // => le_mn2. + by apply: leq_trans le_mn2 le_n21. + rewrite maxnC orbC. + rewrite (maxn_idPl le_n12) orb_idr // => le_mn1. + by apply: leq_trans le_mn1 le_n12. Qed. -Lemma nat_inj_eq T (f : T -> nat) x y : - injective f -> - reflect (x = y) (eqn (f x) (f y)). -Proof. by move=> f_inj; apply: (iffP eqnP) => [/f_inj|-> //]. Qed. - -Lemma leq_max m n1 n2 : (m <= maxn n1 n2) = (m <= n1) || (m <= n2). +Lemma leq_max3 m n1 n2 : (m <= maxn n1 n2) = (m <= n1) || (m <= n2). Proof. -wlog le_n21: n1 n2 / n2 <= n1 => [th_sym|]. - by case/orP: (leq_total n2 n1) => /th_sym; last rewrite maxnC orbC. -by rewrite (maxn_idPl le_n21) orb_idr // => /leq_trans->. + have th_sym x y: y <= x -> (m <= maxn x y) = (m <= x) || (m <= y). + move=> le_yx; rewrite (maxn_idPl le_yx) orb_idr // => le_my. + by apply: leq_trans le_my le_yx. + by case: (orP (leq_total n2 n1)) => /th_sym; last rewrite maxnC orbC. Qed. -Definition edivn_rec d := - fix loop m q := if m - d is m'.+1 then loop m' q.+1 else (q, m). - -Definition edivn m d := if d > 0 then edivn_rec d.-1 m 0 else (0, m). - -Lemma edivn_recE d m q : - edivn_rec d m q = - if m - d is m'.+1 then edivn_rec d m' q.+1 else (q, m). -Proof. by elim: m. Qed. - -Lemma test (G : nat -> Prop) m : G m. -Proof. -case: (ubnPgeq m). Show. -Abort. - -Lemma edivnP m d (ed := edivn m d) : - ((d > 0) ==> (ed.2 < d)) && (m == ed.1 * d + ed.2). +Lemma leq_max2 m n1 n2 : (m <= maxn n1 n2) = (m <= n1) || (m <= n2). Proof. -rewrite -[m]/(0 * d + m). -case: d => [//= | d /=] in ed *. -rewrite -[edivn m d.+1]/(edivn_rec d m 0) in ed *. -case: (ubnPgeq m) @ed; elim: m 0 => [|m IHm] q [/=|n] leq_nm //. -rewrite edivn_recE subn_if_gt; case: ifP => [le_dm ed|lt_md]; last first. - by rewrite /= ltnS ltnNge lt_md eqxx. -rewrite -ltnS in le_dm; rewrite -(subnKC le_dm) addnA -mulSnr. -by apply: IHm q.+1 (n-d) _; apply: leq_trans (leq_subr d n) leq_nm. + suff th_sym x y: y <= x -> (m <= maxn x y) = (m <= x) || (m <= y). + by case: (orP (leq_total n2 n1)) => /th_sym; last rewrite maxnC orbC. + move=> le_yx; rewrite (maxn_idPl le_yx) orb_idr // => le_my. + by apply: leq_trans le_my le_yx. Qed. -Lemma dvdn_fact m n : 0 < m <= n -> m %| n`!. +Lemma leq_max1 m n1 n2 : (m <= maxn n1 n2) = (m <= n1) || (m <= n2). Proof. -case: m => //= m; elim: n => //= n IHn; rewrite ltnS leq_eqVlt. -by case/orP=> [/eqP-> | /IHn]; [apply: dvdn_mulr | apply: dvdn_mull]. + wlog le_n21: n1 n2 / n2 <= n1 => [th_sym|]. + by case: (orP (leq_total n2 n1)) => /th_sym; last rewrite maxnC orbC. + rewrite (maxn_idPl le_n21) orb_idr // => le_mn2. + by apply: leq_trans le_mn2 le_n21. Qed. -Lemma prime_above m : exists2 p, m < p & prime p. +Lemma leq_max m n1 n2 : (m <= maxn n1 n2) = (m <= n1) || (m <= n2). Proof. -have /pdivP[p pr_p p_dv_m1]: 1 < m`! + 1 by rewrite addn1 ltnS fact_gt0. -exists p => //; rewrite ltnNge; apply: contraL p_dv_m1 => p_le_m. -by rewrite dvdn_addr ?dvdn_fact ?prime_gt0 // gtnNdvd ?prime_gt1. + wlog le_n21: n1 n2 / n2 <= n1 => [th_sym|]. + by case: (orP (leq_total n2 n1)) => /th_sym; last rewrite maxnC orbC. + by rewrite (maxn_idPl le_n21) orb_idr // => /leq_trans->. Qed. From b2815c5b455b3bf44958cceec169d79167b71c51 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Mon, 6 Dec 2021 16:15:50 +0300 Subject: [PATCH 13/18] Chapter 4 edits --- coq/ch4.v | 1 + 1 file changed, 1 insertion(+) diff --git a/coq/ch4.v b/coq/ch4.v index 58dcdfd0..15fe4983 100644 --- a/coq/ch4.v +++ b/coq/ch4.v @@ -2,6 +2,7 @@ From mathcomp Require Import all_ssreflect. (* 4.1.1 Pulling from the stack *) + Goal forall xy, prime xy.1 -> odd xy.2 -> 2 < xy.2 + xy.1. move => xy pr_x odd_y. Abort. From 2a8efeb2520f0e0a26bf3d9605d2eb61a830122a Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Mon, 6 Dec 2021 16:16:02 +0300 Subject: [PATCH 14/18] Chapter 5 --- coq/ch5.v | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 coq/ch5.v diff --git a/coq/ch5.v b/coq/ch5.v new file mode 100644 index 00000000..ba752b54 --- /dev/null +++ b/coq/ch5.v @@ -0,0 +1,159 @@ +From mathcomp Require Import all_ssreflect. + + +(* 5 Inductive specifications *) + +Fixpoint has T (a : T -> bool) (s : seq T) : bool := + if s is x :: s' then a x || has _ a s' else false. + +Definition has_prop T (a : T -> bool) (x0 : T) (s : seq T) := + exists i, i < size s /\ a (nth x0 s i). + + +(* 5.1.1 Relating statements in bool and Prop *) + +Definition bool_Prop_equiv (P : Prop) (b : bool) := b = true <-> P. + +Lemma test_bool_Prop_equiv b P : bool_Prop_equiv P b -> P \/ ~ P. +Proof. + case: b; case => hlr hrl. + by left; apply: hlr. + by right => hP; move: (hrl hP). +Qed. + +Inductive reflect1 (P : Prop) (b : bool) : Prop := +| ReflectT1 (p : P) (e : b = true) +| ReflectF1 (np : ~ P) (e : b = false). + +Lemma test_reflect b P : reflect P b -> P \/ ~ P. +Proof. case. Abort. + +Lemma andP1 (b1 b2 : bool) : reflect (b1 /\ b2) (b1 && b2). +Proof. by case: b1; case: b2; [ left | right => //= [[l r]] ..]. Qed. + +Lemma orP1 (b1 b2 : bool) : reflect (b1 \/ b2) (b1 || b2). +Proof. + case: b1; case: b2; [ left; by [ move | left | right ] .. |]. + by right=> // [[l|r]]. +Qed. + +Lemma implyP1 (b1 b2 : bool) : reflect (b1 -> b2) (b1 ==> b2). +Proof. + by case: b1; case: b2; [ left | right | left ..] => //= /(_ isT). +Qed. + + +(* 5.1.2 Proving reflection views *) + +Lemma eqnP1 (n m : nat) : reflect (n = m) (eqn n m). Admitted. + +About iffP. +(* iffP : forall [P Q : Prop] [b : bool], reflect P b -> (P -> Q) -> (Q -> P) -> reflect Q b *) + +Lemma idP1 {b : bool} : reflect b b. Admitted. + +Lemma eqnP2 {n m : nat} : reflect (n = m) (eqn n m). + apply: (iffP idP). +Admitted. + +Lemma nat_inj_eq1 T (f : T -> nat) x y : + injective f -> reflect (x = y) (eqn (f x) (f y)). +Proof. + move=> f_inj. + apply: (iffP eqnP). +Admitted. + + +(* 5.1.3 Using views in intro patterns *) + +Goal forall n m k, k <= n -> (n <= m) && (m <= k) -> n = k. +Proof. + move => n m k lekn /andP. +Abort. + +Lemma elimTF1 (P : Prop) (b c : bool) : + reflect P b -> b = c -> if c then P else ~ P. Admitted. + +Goal forall n m k, k <= n -> (n <= m) && (m <= k) -> n = k. +Proof. + move=> n m k lekn /andP[lenm lemk]. +Abort. + +Lemma example n m k : k <= n -> (n <= m) && (m <= k) -> n = k. +Proof. + move=> lekn /andP[/eqnP lenm lemk]. +Abort. + + +(* 5.1.4 Using views with tactics *) + +Goal forall m n, (m <= n) || (m >= n). + move => m n; rewrite -implyNb. + (* ~~ (m <= n) ==> (n <= m) *) +Abort. + +Goal forall m n, (m <= n) || (m >= n). + move => m n; rewrite -implyNb -ltnNge. + (* (n < m) ==> (n <= m) *) +Abort. + +Goal forall m n, (m <= n) || (m >= n). + move => m n; rewrite -implyNb -ltnNge; apply/implyP. + (* n < m -> n <= m *) +Abort. + +Lemma leq_total m n : (m <= n) || (m >= n). +Proof. by rewrite -implyNb -ltnNge; apply/implyP; apply: ltnW. Qed. + +Goal forall m n1 n2, (m <= maxn n1 n2) = (m <= n1) || (m <= n2). + move => m n1 n2; case/orP: (leq_total n2 n1) => [le_n21 | le_n12]. +Abort. + +Lemma maxn_idPl {m n} : reflect (maxn m n = m) (m >= n). Admitted. + +Lemma leq_max m n1 n2 : (m <= maxn n1 n2) = (m <= n1) || (m <= n2). +Proof. + case/orP: (leq_total n2 n1) => [le_n21 | le_n12]. + rewrite (maxn_idPl le_n21). +Admitted. + +Inductive reflect (P : Prop) : bool -> Prop := +| ReflectT (p : P) : reflect P true +| ReflectF (np : ~ P) : reflect P false. + + +Goal forall a b, a && b ==> (a == b). + move => a b; case: andP => [ab|nab]. + (* true ==> (a == b) *) + (* false => (a == b) *) +Abort. + +Lemma example a b : a && b ==> (a == b). +Proof. by case: andP => [[-> ->] |]. Qed. + +Lemma example1 a b : (a || ~~ a) && (a && b ==> (a == b)). +Proof. by case: (a && _) / andP => [[-> ->] |] //; rewrite orbN. Qed. + +Section If. + Variables (A : Type) (vT vF : A) (b : bool). + + Inductive if_spec : bool -> A -> Type := + | IfSpecTrue (p : b) : if_spec true vT + | IfSpecFalse (p : b = false) : if_spec false vF. + + Lemma ifP : if_spec b (if b then vT else vF). Admitted. +End If. + + +(* 5.3 Strong induction via inductive specs *) + +Inductive ubn_geq_spec m : nat -> Type := + UbnGeq n of n <= m : ubn_geq_spec m n. + +Lemma ubnPgeq m : ubn_geq_spec m m. +Proof. by []. Qed. + +Lemma test_ubnP (G : nat -> Prop) m : G m. +Proof. + case: (ubnPgeq m). +Admitted. From ba9df514bbd7fe31082a6c25f7435a4d9de82ad0 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Mon, 6 Dec 2021 17:07:58 +0300 Subject: [PATCH 15/18] Chapter 5 finished --- coq/ch5.v | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/coq/ch5.v b/coq/ch5.v index ba752b54..b3bd552a 100644 --- a/coq/ch5.v +++ b/coq/ch5.v @@ -3,10 +3,10 @@ From mathcomp Require Import all_ssreflect. (* 5 Inductive specifications *) -Fixpoint has T (a : T -> bool) (s : seq T) : bool := - if s is x :: s' then a x || has _ a s' else false. +Fixpoint has' T (a : T -> bool) (s : seq T) : bool := + if s is x :: s' then a x || has' _ a s' else false. -Definition has_prop T (a : T -> bool) (x0 : T) (s : seq T) := +Definition has_prop' T (a : T -> bool) (x0 : T) (s : seq T) := exists i, i < size s /\ a (nth x0 s i). @@ -157,3 +157,52 @@ Lemma test_ubnP (G : nat -> Prop) m : G m. Proof. case: (ubnPgeq m). Admitted. + + +(* 5.4 Showcase: Euclidean division, simple and correct *) + +Definition edivn_rec d := + fix loop m q := if m - d is m'.+1 then loop m' q.+1 else (q, m). + +Definition edivn m d := if d > 0 then edivn_rec d.-1 m 0 else (0, m). + +Lemma edivn_recE d m q : + edivn_rec d m q = if m - d is m'.+1 then edivn_rec d m' q.+1 else (q,m). +Proof. by case: m. Qed. + +Lemma edivnP m d (ed := edivn m d) : + ((d > 0) ==> (ed.2 < d)) && (m == ed.1 * d + ed.2). +Proof. + rewrite -[m]/(0 * d + m). + case: d => [//= | d /=] in ed *. + rewrite -[edivn m d.+1]/(edivn_rec d m 0) in ed *. + case: (ubnPgeq m) @ed; elim: m 0 => [|m IHm] q [/=|n] leq_nm //. + rewrite edivn_recE subn_if_gt; case: ifP => [le_dm ed|lt_md]; last first. + by rewrite /= ltnS ltnNge lt_md eqxx. + rewrite -ltnS in le_dm; rewrite -(subnKC le_dm) addnA -mulSnr subSS. + by apply: IHm q.+1 (n-d) _; apply: leq_trans (leq_subr d n) leq_nm. +Qed. + +Lemma subn_if_gt T m n F (E : T) : + (if m.+1 - n is m'.+1 then F m' else E) = + (if n <= m then F (m - n) else E). Admitted. + + +(* 5.5 Notational aspects of specifications *) + +Lemma example3 : prime 17. Admitted. + +Definition is_true b := b = true. + +Coercion is_true : bool >-> Sortclass. (* Prop *) + +Fixpoint count (a : pred nat) (s : seq nat) := + if s is x :: s' then a x + count a s' else 0. + +Lemma count_uniq_mem (s : seq nat) x : + uniq s -> count (pred1 x) s = has (pred1 x) s. Admitted. + +Definition zerolist n := mkseq (fun _ => 0) n. +Coercion zerolist : nat >-> seq. +Check 2 :: true == [:: 2; 0]. + From 6ce7cbe9718a4a455b77750c39626874ad3ffbf3 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Mon, 6 Dec 2021 19:11:15 +0300 Subject: [PATCH 16/18] some changes to make ch3 and ch5 work using jscoq --- coq/Makefile | 2 +- coq/ch3.v | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/coq/Makefile b/coq/Makefile index 68e238c4..aafc19da 100644 --- a/coq/Makefile +++ b/coq/Makefile @@ -1,4 +1,4 @@ -files=ch0.v ch1.v ch2.v ch3.v ch4.v ch6.v ch7_1.v ch7_2.v ch7_3.v ch7_4.v ch7_5.v ch8.v +files=ch0.v ch1.v ch2.v ch3.v ch4.v ch5.v ch6.v ch7_1.v ch7_2.v ch7_3.v ch7_4.v ch7_5.v ch8.v all: check $(files:%.v=%.html) index.html node_modules diff --git a/coq/ch3.v b/coq/ch3.v index 9e0fbf4d..e75b39d9 100644 --- a/coq/ch3.v +++ b/coq/ch3.v @@ -178,6 +178,7 @@ Fail Check oops (Hide oops). (* : False *) (* Code below is not in the book anymore and given here as *) (* additional examples. *) +(* Lemma stamps n : 12 <= n -> exists s4 s5, s4 * 4 + s5 * 5 = n. Proof. have [m leq_mn] := ubnPgeq n; elim: n => // n IHn in m leq_mn *; first by case: n => [|n] in IHn *. @@ -190,6 +191,7 @@ case: (IHn ((16+m) - 4) _ isT) => [|s4 [s5 def_m4]]. by rewrite leq_subLR (leq_trans leq_mn) // addSnnS leq_addl. by exists s4.+1, s5; rewrite mulSn -addnA def_m4 subnKC. Qed. +*) Lemma absurd : false = true -> forall P, P. Proof. by []. Qed. From 09c5c17bd6cce1df6461a48bd60fb1cc7452ebc6 Mon Sep 17 00:00:00 2001 From: Klaus Andrey Date: Mon, 6 Dec 2021 19:15:16 +0300 Subject: [PATCH 17/18] Node modules updated --- .../@corwin.amber/hastebin/package.json | 2 +- .../node_modules/@jscoq/mathcomp/package.json | 2 +- .../node_modules/accepts/package.json | 2 +- .../node_modules/array-equal/package.json | 2 +- .../node_modules/array-flatten/package.json | 2 +- .../snippets/node_modules/assert/package.json | 2 +- .../node_modules/async-cache/package.json | 2 +- docs/snippets/node_modules/async/package.json | 2 +- .../available-typed-arrays/.eslintrc | 4 + .../available-typed-arrays/CHANGELOG.md | 10 + .../available-typed-arrays/index.js | 4 +- .../available-typed-arrays/package.json | 28 +- .../node_modules/balanced-match/package.json | 2 +- .../node_modules/base64-js/package.json | 2 +- .../bl/node_modules/inherits/package.json | 2 +- .../node_modules/readable-stream/package.json | 2 +- .../bl/node_modules/safe-buffer/package.json | 2 +- .../node_modules/string_decoder/package.json | 2 +- docs/snippets/node_modules/bl/package.json | 2 +- .../node_modules/body-parser/package.json | 2 +- .../node_modules/bootstrap/package.json | 2 +- .../node_modules/brace-expansion/package.json | 2 +- .../node_modules/buffer-writer/package.json | 2 +- .../snippets/node_modules/buffer/package.json | 2 +- .../snippets/node_modules/busboy/package.json | 2 +- docs/snippets/node_modules/bytes/package.json | 2 +- .../node_modules/call-bind/package.json | 5 +- docs/snippets/node_modules/codemirror/AUTHORS | 21 + .../node_modules/codemirror/CHANGELOG.md | 78 + .../codemirror/addon/fold/foldcode.js | 10 +- .../codemirror/addon/hint/show-hint.js | 20 +- .../codemirror/addon/lint/lint.css | 8 + .../codemirror/addon/lint/lint.js | 68 +- .../codemirror/addon/merge/merge.js | 3 + .../codemirror/addon/search/search.js | 40 +- .../codemirror/addon/search/searchcursor.js | 31 +- .../node_modules/codemirror/keymap/emacs.js | 8 +- .../node_modules/codemirror/keymap/vim.js | 350 +- .../codemirror/lib/codemirror.css | 21 +- .../node_modules/codemirror/lib/codemirror.js | 68 +- .../codemirror/mode/clike/clike.js | 2 +- .../codemirror/mode/cobol/cobol.js | 2 +- .../node_modules/codemirror/mode/css/css.js | 44 +- .../node_modules/codemirror/mode/gas/gas.js | 8 + .../codemirror/mode/javascript/javascript.js | 2 +- .../codemirror/mode/julia/julia.js | 32 +- .../node_modules/codemirror/mode/meta.js | 2 +- .../node_modules/codemirror/mode/nsis/nsis.js | 4 +- .../node_modules/codemirror/mode/php/php.js | 6 +- .../codemirror/mode/python/python.js | 21 +- .../node_modules/codemirror/mode/soy/soy.js | 40 +- .../node_modules/codemirror/mode/sql/sql.js | 4 +- .../codemirror/mode/stylus/stylus.js | 4 +- .../node_modules/codemirror/mode/xml/xml.js | 18 +- .../mode/yaml-frontmatter/yaml-frontmatter.js | 30 +- .../node_modules/codemirror/package.json | 75 +- .../codemirror/src/display/Display.js | 4 + .../codemirror/src/display/scroll_events.js | 18 +- .../codemirror/src/display/scrollbars.js | 1 + .../codemirror/src/display/selection.js | 14 +- .../codemirror/src/display/update_lines.js | 6 + .../node_modules/codemirror/src/edit/main.js | 2 +- .../src/input/ContentEditableInput.js | 2 +- .../codemirror/src/input/input.js | 2 +- .../src/measurement/position_measurement.js | 14 +- .../node_modules/codemirror/src/model/Doc.js | 1 + .../codemirror/theme/ayu-dark.css | 2 + .../codemirror/theme/ayu-mirage.css | 4 +- .../codemirror/theme/base16-dark.css | 2 + .../codemirror/theme/gruvbox-dark.css | 2 + .../node_modules/codemirror/theme/juejin.css | 30 + .../codemirror/theme/material-ocean.css | 8 +- .../codemirror/theme/material-palenight.css | 8 +- .../codemirror/theme/material.css | 8 +- .../codemirror/theme/oceanic-next.css | 2 + .../codemirror/theme/solarized.css | 3 - .../snippets/node_modules/colors/package.json | 2 +- .../node_modules/commander/package.json | 2 +- .../node_modules/concat-map/package.json | 2 +- .../connect-ratelimit/package.json | 2 +- .../node_modules/connect-route/package.json | 2 +- .../node_modules/connect/package.json | 2 +- .../content-disposition/package.json | 2 +- .../node_modules/content-type/package.json | 2 +- .../cookie-signature/package.json | 2 +- .../snippets/node_modules/cookie/package.json | 2 +- .../node_modules/core-util-is/float.patch | 604 - .../node_modules/core-util-is/lib/util.js | 2 +- .../node_modules/core-util-is/package.json | 20 +- .../node_modules/core-util-is/test.js | 68 - docs/snippets/node_modules/cors/package.json | 2 +- docs/snippets/node_modules/cycle/package.json | 2 +- docs/snippets/node_modules/debug/package.json | 2 +- .../define-properties/package.json | 2 +- docs/snippets/node_modules/depd/package.json | 2 +- .../node_modules/destroy/package.json | 2 +- docs/snippets/node_modules/dicer/package.json | 2 +- .../node_modules/ee-first/package.json | 2 +- .../node_modules/encodeurl/package.json | 2 +- .../node_modules/es-abstract/.eslintrc | 3 + .../node_modules/es-abstract/.gitattributes | 625 - .../es-abstract/2015/CharacterRange.js | 31 + .../2015/IsCompatiblePropertyDescriptor.js | 9 + .../node_modules/es-abstract/2015/Set.js | 14 +- .../es-abstract/2015/SetFunctionName.js | 2 +- .../node_modules/es-abstract/2015/ToNumber.js | 10 +- .../es-abstract/2016/CharacterRange.js | 31 + .../2016/IsCompatiblePropertyDescriptor.js | 9 + .../node_modules/es-abstract/2016/Set.js | 14 +- .../es-abstract/2016/SetFunctionName.js | 2 +- .../node_modules/es-abstract/2016/ToNumber.js | 10 +- .../es-abstract/2017/CharacterRange.js | 31 + .../2017/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2017/IsSharedArrayBuffer.js | 19 + .../es-abstract/2017/OrdinaryToPrimitive.js | 38 + .../node_modules/es-abstract/2017/Set.js | 14 +- .../es-abstract/2017/SetFunctionName.js | 2 +- .../node_modules/es-abstract/2017/ToNumber.js | 10 +- .../2018/AbstractRelationalComparison.js | 48 +- .../es-abstract/2018/CharacterRange.js | 31 + .../2018/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2018/IsSharedArrayBuffer.js | 19 + .../es-abstract/2018/OrdinaryToPrimitive.js | 38 + .../node_modules/es-abstract/2018/Set.js | 14 +- .../es-abstract/2018/SetFunctionName.js | 2 +- .../node_modules/es-abstract/2018/ToNumber.js | 10 +- .../2019/AbstractRelationalComparison.js | 48 +- .../es-abstract/2019/CharacterRange.js | 31 + .../2019/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2019/IsSharedArrayBuffer.js | 19 + .../es-abstract/2019/OrdinaryToPrimitive.js | 38 + .../node_modules/es-abstract/2019/Set.js | 14 +- .../es-abstract/2019/SetFunctionName.js | 2 +- .../node_modules/es-abstract/2019/ToNumber.js | 10 +- .../2020/AbstractEqualityComparison.js | 28 +- .../2020/AbstractRelationalComparison.js | 71 +- .../es-abstract/2020/CharacterRange.js | 31 + .../2020/CreateRegExpStringIterator.js | 111 + .../2020/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2020/IsSharedArrayBuffer.js | 19 + .../es-abstract/2020/NumberToBigInt.js | 4 + .../es-abstract/2020/OrdinaryToPrimitive.js | 38 + .../node_modules/es-abstract/2020/Set.js | 14 +- .../es-abstract/2020/SetFunctionName.js | 2 +- .../es-abstract/2020/StringToBigInt.js | 23 + .../node_modules/es-abstract/2020/ToBigInt.js | 25 + .../es-abstract/2020/ToBigInt64.js | 25 + .../es-abstract/2020/ToBigUint64.js | 22 + .../node_modules/es-abstract/2020/ToNumber.js | 10 +- .../2021/AbstractEqualityComparison.js | 57 + .../2021/AbstractRelationalComparison.js | 82 + .../2021/AddEntriesFromIterable.js | 52 + .../es-abstract/2021/AddToKeptObjects.js | 21 + .../es-abstract/2021/AdvanceStringIndex.js | 34 + .../ApplyStringOrNumericBinaryOperator.js | 80 + .../es-abstract/2021/ArrayCreate.js | 53 + .../es-abstract/2021/ArraySetLength.js | 85 + .../es-abstract/2021/ArraySpeciesCreate.js | 48 + .../es-abstract/2021/BigInt/add.js | 18 + .../es-abstract/2021/BigInt/bitwiseAND.js | 17 + .../es-abstract/2021/BigInt/bitwiseNOT.js | 17 + .../es-abstract/2021/BigInt/bitwiseOR.js | 17 + .../es-abstract/2021/BigInt/bitwiseXOR.js | 17 + .../es-abstract/2021/BigInt/divide.js | 22 + .../es-abstract/2021/BigInt/equal.js | 17 + .../es-abstract/2021/BigInt/exponentiate.js | 31 + .../es-abstract/2021/BigInt/index.js | 43 + .../es-abstract/2021/BigInt/leftShift.js | 18 + .../es-abstract/2021/BigInt/lessThan.js | 18 + .../es-abstract/2021/BigInt/multiply.js | 18 + .../es-abstract/2021/BigInt/remainder.js | 30 + .../es-abstract/2021/BigInt/sameValue.js | 18 + .../es-abstract/2021/BigInt/sameValueZero.js | 18 + .../2021/BigInt/signedRightShift.js | 18 + .../es-abstract/2021/BigInt/subtract.js | 18 + .../es-abstract/2021/BigInt/toString.js | 18 + .../es-abstract/2021/BigInt/unaryMinus.js | 24 + .../2021/BigInt/unsignedRightShift.js | 17 + .../es-abstract/2021/BigIntBitwiseOp.js | 66 + .../es-abstract/2021/BinaryAnd.js | 14 + .../node_modules/es-abstract/2021/BinaryOr.js | 14 + .../es-abstract/2021/BinaryXor.js | 14 + .../es-abstract/2021/ByteListBitwiseOp.js | 44 + .../es-abstract/2021/ByteListEqual.js | 33 + .../node_modules/es-abstract/2021/Call.js | 20 + .../2021/CanonicalNumericIndexString.js | 22 + .../es-abstract/2021/CharacterRange.js | 31 + .../es-abstract/2021/ClearKeptObjects.js | 12 + .../es-abstract/2021/CodePointAt.js | 58 + .../es-abstract/2021/CodePointsToString.js | 27 + .../2021/CompletePropertyDescriptor.js | 39 + .../es-abstract/2021/CopyDataProperties.js | 70 + .../es-abstract/2021/CreateDataProperty.js | 45 + .../2021/CreateDataPropertyOrThrow.js | 25 + .../es-abstract/2021/CreateHTML.js | 30 + .../2021/CreateIterResultObject.js | 19 + .../2021/CreateListFromArrayLike.js | 44 + .../es-abstract/2021/CreateMethodProperty.js | 40 + .../2021/CreateRegExpStringIterator.js | 111 + .../es-abstract/2021/DateFromTime.js | 54 + .../es-abstract/2021/DateString.js | 30 + .../node_modules/es-abstract/2021/Day.js | 11 + .../es-abstract/2021/DayFromYear.js | 10 + .../es-abstract/2021/DayWithinYear.js | 11 + .../es-abstract/2021/DaysInYear.js | 18 + .../es-abstract/2021/DefinePropertyOrThrow.js | 50 + .../es-abstract/2021/DeletePropertyOrThrow.js | 27 + .../2021/EnumerableOwnPropertyNames.js | 43 + .../es-abstract/2021/FlattenIntoArray.js | 58 + .../2021/FromPropertyDescriptor.js | 36 + .../node_modules/es-abstract/2021/Get.js | 30 + .../es-abstract/2021/GetIterator.js | 65 + .../es-abstract/2021/GetMethod.js | 42 + .../es-abstract/2021/GetOwnPropertyKeys.js | 31 + .../es-abstract/2021/GetPromiseResolve.js | 22 + .../2021/GetPrototypeFromConstructor.js | 28 + .../es-abstract/2021/GetSubstitution.js | 128 + .../node_modules/es-abstract/2021/GetV.js | 29 + .../es-abstract/2021/HasOwnProperty.js | 22 + .../es-abstract/2021/HasProperty.js | 20 + .../es-abstract/2021/HourFromTime.js | 14 + .../es-abstract/2021/InLeapYear.js | 21 + .../es-abstract/2021/InstanceofOperator.js | 30 + .../node_modules/es-abstract/2021/Invoke.js | 24 + .../es-abstract/2021/IsAccessorDescriptor.js | 23 + .../node_modules/es-abstract/2021/IsArray.js | 14 + .../es-abstract/2021/IsBigIntElementType.js | 7 + .../es-abstract/2021/IsCallable.js | 5 + .../2021/IsCompatiblePropertyDescriptor.js | 9 + .../es-abstract/2021/IsConcatSpreadable.js | 25 + .../es-abstract/2021/IsConstructor.js | 40 + .../es-abstract/2021/IsDataDescriptor.js | 23 + .../es-abstract/2021/IsExtensible.js | 20 + .../es-abstract/2021/IsGenericDescriptor.js | 23 + .../es-abstract/2021/IsIntegralNumber.js | 18 + .../es-abstract/2021/IsNoTearConfiguration.js | 16 + .../es-abstract/2021/IsPromise.js | 24 + .../es-abstract/2021/IsPropertyKey.js | 7 + .../node_modules/es-abstract/2021/IsRegExp.js | 24 + .../es-abstract/2021/IsSharedArrayBuffer.js | 19 + .../es-abstract/2021/IsStringPrefix.js | 47 + .../2021/IsUnclampedIntegerElementType.js | 12 + .../es-abstract/2021/IsUnsignedElementType.js | 11 + .../es-abstract/2021/IterableToList.js | 29 + .../es-abstract/2021/IteratorClose.js | 50 + .../es-abstract/2021/IteratorComplete.js | 18 + .../es-abstract/2021/IteratorNext.js | 18 + .../es-abstract/2021/IteratorStep.js | 13 + .../es-abstract/2021/IteratorValue.js | 18 + .../es-abstract/2021/LengthOfArrayLike.js | 20 + .../node_modules/es-abstract/2021/MakeDate.js | 13 + .../node_modules/es-abstract/2021/MakeDay.js | 36 + .../node_modules/es-abstract/2021/MakeTime.js | 23 + .../es-abstract/2021/MinFromTime.js | 14 + .../es-abstract/2021/MonthFromTime.js | 47 + .../es-abstract/2021/Number/add.js | 36 + .../es-abstract/2021/Number/bitwiseAND.js | 17 + .../es-abstract/2021/Number/bitwiseNOT.js | 19 + .../es-abstract/2021/Number/bitwiseOR.js | 17 + .../es-abstract/2021/Number/bitwiseXOR.js | 17 + .../es-abstract/2021/Number/divide.js | 22 + .../es-abstract/2021/Number/equal.js | 21 + .../es-abstract/2021/Number/exponentiate.js | 77 + .../es-abstract/2021/Number/index.js | 43 + .../es-abstract/2021/Number/leftShift.js | 25 + .../es-abstract/2021/Number/lessThan.js | 26 + .../es-abstract/2021/Number/multiply.js | 33 + .../es-abstract/2021/Number/remainder.js | 32 + .../es-abstract/2021/Number/sameValue.js | 21 + .../es-abstract/2021/Number/sameValueZero.js | 24 + .../2021/Number/signedRightShift.js | 25 + .../es-abstract/2021/Number/subtract.js | 19 + .../es-abstract/2021/Number/toString.js | 18 + .../es-abstract/2021/Number/unaryMinus.js | 21 + .../2021/Number/unsignedRightShift.js | 25 + .../es-abstract/2021/NumberBitwiseOp.js | 29 + .../es-abstract/2021/NumberToBigInt.js | 22 + .../2021/OrdinaryCreateFromConstructor.js | 20 + .../2021/OrdinaryDefineOwnProperty.js | 61 + .../2021/OrdinaryGetOwnProperty.js | 44 + .../2021/OrdinaryGetPrototypeOf.js | 21 + .../es-abstract/2021/OrdinaryHasInstance.js | 25 + .../es-abstract/2021/OrdinaryHasProperty.js | 20 + .../es-abstract/2021/OrdinaryObjectCreate.js | 46 + .../2021/OrdinarySetPrototypeOf.js | 53 + .../es-abstract/2021/OrdinaryToPrimitive.js | 38 + .../es-abstract/2021/PromiseResolve.js | 17 + .../es-abstract/2021/QuoteJSONString.js | 54 + .../es-abstract/2021/RegExpCreate.js | 21 + .../es-abstract/2021/RegExpExec.js | 32 + .../2021/RequireObjectCoercible.js | 3 + .../es-abstract/2021/SameValue.js | 13 + .../es-abstract/2021/SameValueNonNumeric.js | 21 + .../es-abstract/2021/SameValueZero.js | 9 + .../es-abstract/2021/SecFromTime.js | 14 + .../node_modules/es-abstract/2021/Set.js | 47 + .../es-abstract/2021/SetFunctionLength.js | 31 + .../es-abstract/2021/SetFunctionName.js | 44 + .../es-abstract/2021/SetIntegrityLevel.js | 57 + .../es-abstract/2021/SpeciesConstructor.js | 32 + .../es-abstract/2021/SplitMatch.js | 38 + .../2021/StrictEqualityComparison.js | 17 + .../es-abstract/2021/StringCreate.js | 40 + .../es-abstract/2021/StringGetOwnProperty.js | 48 + .../es-abstract/2021/StringIndexOf.js | 39 + .../es-abstract/2021/StringPad.js | 43 + .../es-abstract/2021/StringToBigInt.js | 23 + .../es-abstract/2021/StringToCodePoints.js | 29 + .../2021/SymbolDescriptiveString.js | 20 + .../es-abstract/2021/TestIntegrityLevel.js | 42 + .../node_modules/es-abstract/2021/TimeClip.js | 21 + .../es-abstract/2021/TimeFromYear.js | 11 + .../es-abstract/2021/TimeString.js | 25 + .../es-abstract/2021/TimeWithinDay.js | 12 + .../node_modules/es-abstract/2021/ToBigInt.js | 25 + .../es-abstract/2021/ToBigInt64.js | 25 + .../es-abstract/2021/ToBigUint64.js | 22 + .../es-abstract/2021/ToBoolean.js | 5 + .../es-abstract/2021/ToDateString.js | 22 + .../node_modules/es-abstract/2021/ToIndex.js | 26 + .../node_modules/es-abstract/2021/ToInt16.js | 10 + .../node_modules/es-abstract/2021/ToInt32.js | 9 + .../node_modules/es-abstract/2021/ToInt8.js | 10 + .../es-abstract/2021/ToIntegerOrInfinity.js | 15 + .../node_modules/es-abstract/2021/ToLength.js | 12 + .../node_modules/es-abstract/2021/ToNumber.js | 62 + .../es-abstract/2021/ToNumeric.js | 21 + .../node_modules/es-abstract/2021/ToObject.js | 14 + .../es-abstract/2021/ToPrimitive.js | 12 + .../es-abstract/2021/ToPropertyDescriptor.js | 52 + .../es-abstract/2021/ToPropertyKey.js | 15 + .../node_modules/es-abstract/2021/ToString.js | 15 + .../node_modules/es-abstract/2021/ToUint16.js | 19 + .../node_modules/es-abstract/2021/ToUint32.js | 9 + .../node_modules/es-abstract/2021/ToUint8.js | 20 + .../es-abstract/2021/ToUint8Clamp.js | 19 + .../es-abstract/2021/TrimString.js | 29 + .../node_modules/es-abstract/2021/Type.js | 15 + .../es-abstract/2021/UTF16EncodeCodePoint.js | 25 + .../2021/UTF16SurrogatePairToCodePoint.js | 19 + .../es-abstract/2021/UnicodeEscape.js | 27 + .../ValidateAndApplyPropertyDescriptor.js | 170 + .../es-abstract/2021/WeakRefDeref.js | 24 + .../node_modules/es-abstract/2021/WeekDay.js | 10 + .../es-abstract/2021/YearFromTime.js | 16 + .../node_modules/es-abstract/2021/abs.js | 11 + .../node_modules/es-abstract/2021/clamp.js | 18 + .../node_modules/es-abstract/2021/floor.js | 11 + .../node_modules/es-abstract/2021/modulo.js | 9 + .../es-abstract/2021/msFromTime.js | 11 + .../es-abstract/2021/substring.js | 20 + .../es-abstract/2021/thisBigIntValue.js | 22 + .../es-abstract/2021/thisBooleanValue.js | 15 + .../es-abstract/2021/thisNumberValue.js | 18 + .../es-abstract/2021/thisStringValue.js | 15 + .../es-abstract/2021/thisSymbolValue.js | 19 + .../es-abstract/2021/thisTimeValue.js | 3 + .../es-abstract/5/FromPropertyDescriptor.js | 4 +- .../node_modules/es-abstract/CHANGELOG.md | 48 + .../node_modules/es-abstract/es2015.js | 2 + .../node_modules/es-abstract/es2016.js | 2 + .../node_modules/es-abstract/es2017.js | 4 + .../node_modules/es-abstract/es2018.js | 4 + .../node_modules/es-abstract/es2019.js | 4 + .../node_modules/es-abstract/es2020.js | 9 + .../node_modules/es-abstract/es2021.js | 178 + .../es-abstract/helpers/DefineOwnProperty.js | 18 + .../es-abstract/helpers/getInferredName.js | 10 +- .../helpers/getOwnPropertyDescriptor.js | 2 +- .../helpers/getSymbolDescription.js | 41 +- .../es-abstract/helpers/modBigInt.js | 6 + .../node_modules/es-abstract/index.js | 4 +- .../es-abstract/operations/2021.js | 439 + .../node_modules/es-abstract/package.json | 56 +- .../es-abstract/test/GetIntrinsic.js | 207 - .../node_modules/es-abstract/test/diffOps.js | 58 - .../node_modules/es-abstract/test/es2015.js | 144 - .../node_modules/es-abstract/test/es2016.js | 165 - .../node_modules/es-abstract/test/es2017.js | 211 - .../node_modules/es-abstract/test/es2018.js | 229 - .../node_modules/es-abstract/test/es2019.js | 231 - .../node_modules/es-abstract/test/es2020.js | 240 - .../node_modules/es-abstract/test/es5.js | 14 - .../node_modules/es-abstract/test/es6.js | 18 - .../node_modules/es-abstract/test/es7.js | 18 - .../test/helpers/OwnPropertyKeys.js | 42 - .../es-abstract/test/helpers/assertRecord.js | 60 - .../test/helpers/createBoundESNamespace.js | 23 - .../test/helpers/defineProperty.js | 27 - .../es-abstract/test/helpers/index.js | 6 - .../es-abstract/test/helpers/isByteValue.js | 28 - .../es-abstract/test/helpers/isCodePoint.js | 20 - .../test/helpers/runManifestTest.js | 27 - .../node_modules/es-abstract/test/index.js | 35 - .../es-abstract/test/ses-compat.js | 8 - .../node_modules/es-abstract/test/tests.js | 6962 ------- .../node_modules/es-to-primitive/package.json | 2 +- .../es6-object-assign/package.json | 2 +- .../node_modules/escape-html/package.json | 2 +- docs/snippets/node_modules/etag/package.json | 2 +- .../node_modules/express/package.json | 2 +- docs/snippets/node_modules/eyes/package.json | 2 +- docs/snippets/node_modules/fd/package.json | 2 +- .../node_modules/fflate-unzip/package.json | 2 +- .../snippets/node_modules/fflate/package.json | 2 +- .../node_modules/finalhandler/package.json | 2 +- docs/snippets/node_modules/find/package.json | 2 +- .../node_modules/foreach/package.json | 2 +- .../node_modules/forwarded/package.json | 2 +- docs/snippets/node_modules/fresh/package.json | 2 +- .../node_modules/fs.realpath/package.json | 2 +- .../node_modules/function-bind/package.json | 5 +- .../node_modules/get-intrinsic/package.json | 7 +- .../get-symbol-description/.eslintignore | 1 + .../get-symbol-description/.eslintrc | 14 + .../.github/FUNDING.yml | 12 + .../get-symbol-description/.nycrc | 9 + .../get-symbol-description/CHANGELOG.md | 16 + .../get-symbol-description/LICENSE | 21 + .../get-symbol-description/getInferredName.js | 10 + .../get-symbol-description/index.js | 43 + .../get-symbol-description/package.json | 99 + .../test/index.js} | 6 +- docs/snippets/node_modules/glob/changelog.md | 67 - docs/snippets/node_modules/glob/common.js | 2 + docs/snippets/node_modules/glob/glob.js | 9 +- docs/snippets/node_modules/glob/package.json | 13 +- docs/snippets/node_modules/glob/sync.js | 9 +- .../node_modules/graceful-fs/graceful-fs.js | 154 +- .../node_modules/graceful-fs/package.json | 12 +- .../node_modules/has-bigints/package.json | 3 +- .../node_modules/has-symbols/package.json | 8 +- .../node_modules/has-tostringtag/.eslintrc | 11 + .../has-tostringtag/.github/FUNDING.yml | 12 + .../node_modules/has-tostringtag/CHANGELOG.md | 20 + .../node_modules/has-tostringtag/LICENSE | 21 + .../node_modules/has-tostringtag/index.js | 7 + .../node_modules/has-tostringtag/package.json | 117 + .../node_modules/has-tostringtag/shams.js | 7 + .../has-tostringtag/test/index.js | 21 + .../has-tostringtag/test/shams/core-js.js | 28 + .../test/shams/get-own-property-symbols.js | 28 + .../has-tostringtag/test/tests.js | 14 + docs/snippets/node_modules/has/package.json | 5 +- .../node_modules/highlight.js/package.json | 2 +- .../node_modules/http-errors/package.json | 2 +- .../node_modules/iconv-lite/package.json | 2 +- .../node_modules/ieee754/package.json | 2 +- .../node_modules/immediate/package.json | 2 +- .../node_modules/inflight/package.json | 2 +- .../node_modules/inherits/package.json | 2 +- .../modernizr => internal-slot}/.editorconfig | 16 +- .../node_modules/internal-slot/.eslintignore | 1 + .../node_modules/internal-slot/.eslintrc | 12 + .../internal-slot/.github/FUNDING.yml | 12 + .../node_modules/internal-slot/.nycrc | 13 + .../node_modules/internal-slot/CHANGELOG.md | 58 + .../node_modules/internal-slot/LICENSE | 21 + .../node_modules/internal-slot/index.js | 59 + .../node_modules/internal-slot/package.json | 91 + .../node_modules/internal-slot/test/index.js | 120 + .../node_modules/ipaddr.js/package.json | 2 +- .../snippets/node_modules/is-arguments/.nycrc | 4 - .../node_modules/is-arguments/CHANGELOG.md | 16 + .../node_modules/is-arguments/index.js | 2 +- .../node_modules/is-arguments/package.json | 28 +- .../node_modules/is-arguments/test/index.js | 2 +- .../snippets/node_modules/is-bigint/.eslintrc | 4 - .../node_modules/is-bigint/CHANGELOG.md | 17 + docs/snippets/node_modules/is-bigint/index.js | 4 +- .../node_modules/is-bigint/package.json | 23 +- .../node_modules/is-bigint/test/.eslintrc | 7 - .../node_modules/is-bigint/test/index.js | 11 +- .../is-boolean-object/CHANGELOG.md | 7 + .../node_modules/is-boolean-object/index.js | 2 +- .../is-boolean-object/package.json | 23 +- .../is-boolean-object/test/index.js | 4 +- .../node_modules/is-callable/.editorconfig | 5 + .../is-callable/.github/main.workflow | 14 - docs/snippets/node_modules/is-callable/.nycrc | 4 - .../node_modules/is-callable/CHANGELOG.md | 14 + .../node_modules/is-callable/index.js | 2 +- .../node_modules/is-callable/package.json | 66 +- .../node_modules/is-callable/test/index.js | 72 +- .../node_modules/is-date-object/.jscs.json | 176 - .../node_modules/is-date-object/CHANGELOG.md | 8 + .../node_modules/is-date-object/index.js | 2 +- .../node_modules/is-date-object/package.json | 21 +- .../node_modules/is-date-object/test/index.js | 4 +- .../is-generator-function/CHANGELOG.md | 8 + .../is-generator-function/index.js | 2 +- .../is-generator-function/package.json | 23 +- .../is-generator-function/test/index.js | 2 +- .../snippets/node_modules/is-nan/package.json | 2 +- .../is-negative-zero/package.json | 2 +- .../node_modules/is-number-object/.eslintrc | 7 + .../node_modules/is-number-object/.nycrc | 3 +- .../is-number-object/CHANGELOG.md | 8 + .../node_modules/is-number-object/index.js | 2 +- .../is-number-object/package.json | 27 +- .../is-number-object/test/corejs.js | 5 - .../is-number-object/test/index.js | 4 +- .../node_modules/is-regex/CHANGELOG.md | 7 + docs/snippets/node_modules/is-regex/index.js | 3 +- .../node_modules/is-regex/package.json | 32 +- .../node_modules/is-regex/test/index.js | 3 +- .../is-shared-array-buffer/.eslintignore | 1 + .../is-shared-array-buffer/.eslintrc | 18 + .../.github/FUNDING.yml | 12 + .../is-shared-array-buffer/.nycrc | 13 + .../is-shared-array-buffer/CHANGELOG.md | 28 + .../is-shared-array-buffer/LICENSE | 21 + .../is-shared-array-buffer/index.js | 21 + .../is-shared-array-buffer/package.json | 89 + .../is-shared-array-buffer/test/index.js | 27 + .../node_modules/is-string/CHANGELOG.md | 7 + docs/snippets/node_modules/is-string/index.js | 2 +- .../node_modules/is-string/package.json | 33 +- .../node_modules/is-string/test/index.js | 4 +- .../node_modules/is-symbol/package.json | 2 +- .../node_modules/is-typed-array/.eslintrc | 4 + .../node_modules/is-typed-array/.nycrc | 4 - .../node_modules/is-typed-array/CHANGELOG.md | 20 + .../node_modules/is-typed-array/index.js | 25 +- .../node_modules/is-typed-array/package.json | 33 +- .../node_modules/is-typed-array/test/index.js | 5 +- .../node_modules/is-weakref/.eslintignore | 1 + .../node_modules/is-weakref/.eslintrc | 13 + .../is-weakref/.github/FUNDING.yml | 12 + .../.github/workflows/node-4+.yml | 0 .../.github/workflows/node-iojs.yml | 0 .../.github/workflows/node-pretest.yml | 0 .../.github/workflows/node-zero.yml | 0 .../.github/workflows/rebase.yml | 0 .../.github/workflows/require-allow-edits.yml | 0 docs/snippets/node_modules/is-weakref/.nycrc | 13 + .../node_modules/is-weakref/CHANGELOG.md | 34 + docs/snippets/node_modules/is-weakref/LICENSE | 21 + .../snippets/node_modules/is-weakref/index.js | 21 + .../node_modules/is-weakref/package.json | 92 + .../node_modules/is-weakref/test/index.js | 26 + .../node_modules/isarray/package.json | 2 +- .../node_modules/isstream/package.json | 2 +- .../snippets/node_modules/jquery/package.json | 2 +- .../node_modules/js-tokens/package.json | 2 +- docs/snippets/node_modules/jscoq/package.json | 2 +- docs/snippets/node_modules/jszip/CHANGES.md | 18 +- .../snippets/node_modules/jszip/dist/jszip.js | 11364 ++++++++++- .../node_modules/jszip/dist/jszip.min.js | 4 +- docs/snippets/node_modules/jszip/lib/index.js | 7 +- .../snippets/node_modules/jszip/lib/object.js | 6 +- .../jszip/node_modules/isarray/package.json | 2 +- .../node_modules/readable-stream/package.json | 2 +- .../node_modules/string_decoder/package.json | 2 +- docs/snippets/node_modules/jszip/package.json | 16 +- docs/snippets/node_modules/lie/package.json | 2 +- .../.tscache/typing_tests/timestamp | 0 .../node_modules/localforage/CHANGELOG.md | 4 + .../node_modules/localforage/bower.json | 2 +- .../bower_components/assert/.bower.json | 23 - .../bower_components/assert/HISTORY.md | 50 - .../bower_components/assert/assert.js | 436 - .../bower_components/assert/bower.json | 14 - .../bower_components/assert/package.json | 12 - .../bower_components/es6-promise/.bower.json | 15 - .../bower_components/es6-promise/bower.json | 5 - .../bower_components/es6-promise/promise.js | 684 - .../es6-promise/promise.min.js | 1 - .../bower_components/expect/.bower.json | 14 - .../bower_components/expect/History.md | 54 - .../bower_components/expect/index.js | 1284 -- .../bower_components/expect/package.json | 13 - .../bower_components/mocha/.bower.json | 48 - .../bower_components/mocha/CHANGELOG.md | 1635 -- .../bower_components/mocha/CONTRIBUTING.md | 84 - .../bower_components/mocha/LICENSE | 22 - .../bower_components/mocha/bower.json | 38 - .../bower_components/mocha/mocha.css | 326 - .../bower_components/mocha/mocha.js | 16205 ---------------- .../bower_components/modernizr/.bower.json | 14 - .../modernizr/feature-detects/a-download.js | 8 - .../feature-detects/audio-audiodata-api.js | 4 - .../feature-detects/audio-webaudio-api.js | 4 - .../modernizr/feature-detects/battery-api.js | 8 - .../feature-detects/battery-level.js | 11 - .../feature-detects/blob-constructor.js | 10 - .../feature-detects/canvas-todataurl-type.js | 28 - .../feature-detects/contenteditable.js | 9 - .../feature-detects/contentsecuritypolicy.js | 10 - .../modernizr/feature-detects/contextmenu.js | 11 - .../modernizr/feature-detects/cookies.js | 15 - .../modernizr/feature-detects/cors.js | 3 - .../css-backgroundposition-shorthand.js | 19 - .../css-backgroundposition-xy.js | 15 - .../feature-detects/css-backgroundrepeat.js | 31 - .../css-backgroundsizecover.js | 10 - .../feature-detects/css-boxsizing.js | 9 - .../modernizr/feature-detects/css-calc.js | 12 - .../feature-detects/css-cubicbezierrange.js | 8 - .../feature-detects/css-displayrunin.js | 18 - .../feature-detects/css-displaytable.js | 27 - .../modernizr/feature-detects/css-filters.js | 7 - .../modernizr/feature-detects/css-hyphens.js | 205 - .../feature-detects/css-lastchild.js | 11 - .../modernizr/feature-detects/css-mask.js | 12 - .../feature-detects/css-mediaqueries.js | 3 - .../feature-detects/css-objectfit.js | 6 - .../feature-detects/css-overflow-scrolling.js | 9 - .../feature-detects/css-pointerevents.js | 25 - .../feature-detects/css-positionsticky.js | 13 - .../modernizr/feature-detects/css-regions.js | 55 - .../modernizr/feature-detects/css-remunit.js | 19 - .../modernizr/feature-detects/css-resize.js | 8 - .../feature-detects/css-scrollbars.js | 19 - .../modernizr/feature-detects/css-shapes.js | 4 - .../feature-detects/css-subpixelfont.js | 23 - .../modernizr/feature-detects/css-supports.js | 6 - .../feature-detects/css-userselect.js | 10 - .../modernizr/feature-detects/css-vhunit.js | 14 - .../modernizr/feature-detects/css-vmaxunit.js | 14 - .../modernizr/feature-detects/css-vminunit.js | 14 - .../modernizr/feature-detects/css-vwunit.js | 14 - .../custom-protocol-handler.js | 10 - .../modernizr/feature-detects/dart.js | 6 - .../modernizr/feature-detects/dataview-api.js | 4 - .../feature-detects/dom-classlist.js | 4 - .../dom-createElement-attrs.js | 11 - .../modernizr/feature-detects/dom-dataset.js | 9 - .../feature-detects/dom-microdata.js | 4 - .../feature-detects/elem-datalist.js | 12 - .../modernizr/feature-detects/elem-details.js | 25 - .../modernizr/feature-detects/elem-output.js | 4 - .../feature-detects/elem-progress-meter.js | 11 - .../modernizr/feature-detects/elem-ruby.js | 53 - .../modernizr/feature-detects/elem-time.js | 4 - .../modernizr/feature-detects/elem-track.js | 11 - .../modernizr/feature-detects/emoji.js | 11 - .../feature-detects/es5-strictmode.js | 7 - .../event-deviceorientation-motion.js | 11 - .../feature-detects/exif-orientation.js | 32 - .../modernizr/feature-detects/file-api.js | 12 - .../feature-detects/file-filesystem.js | 9 - .../feature-detects/forms-fileinput.js | 13 - .../feature-detects/forms-formattribute.js | 29 - .../feature-detects/forms-inputnumber-l10n.js | 32 - .../feature-detects/forms-placeholder.js | 10 - .../feature-detects/forms-speechinput.js | 19 - .../feature-detects/forms-validation.js | 62 - .../feature-detects/fullscreen-api.js | 10 - .../modernizr/feature-detects/gamepad.js | 12 - .../modernizr/feature-detects/getusermedia.js | 5 - .../modernizr/feature-detects/ie8compat.js | 12 - .../feature-detects/iframe-sandbox.js | 5 - .../feature-detects/iframe-seamless.js | 5 - .../feature-detects/iframe-srcdoc.js | 5 - .../modernizr/feature-detects/img-apng.js | 26 - .../modernizr/feature-detects/img-webp.js | 20 - .../modernizr/feature-detects/json.js | 7 - .../feature-detects/lists-reversed.js | 6 - .../modernizr/feature-detects/mathml.js | 23 - .../feature-detects/network-connection.js | 22 - .../feature-detects/network-eventsource.js | 5 - .../modernizr/feature-detects/network-xhr2.js | 13 - .../modernizr/feature-detects/notification.js | 10 - .../modernizr/feature-detects/performance.js | 5 - .../feature-detects/pointerlock-api.js | 4 - .../feature-detects/quota-management-api.js | 11 - .../feature-detects/requestanimationframe.js | 7 - .../modernizr/feature-detects/script-async.js | 3 - .../modernizr/feature-detects/script-defer.js | 3 - .../modernizr/feature-detects/style-scoped.js | 6 - .../modernizr/feature-detects/svg-filters.js | 13 - .../modernizr/feature-detects/unicode.js | 32 - .../modernizr/feature-detects/url-data-uri.js | 26 - .../modernizr/feature-detects/userdata.js | 7 - .../modernizr/feature-detects/vibration.js | 4 - .../modernizr/feature-detects/web-intents.js | 6 - .../feature-detects/webgl-extensions.js | 42 - .../feature-detects/websockets-binary.js | 20 - .../feature-detects/window-framed.js | 8 - .../feature-detects/workers-blobworkers.js | 66 - .../feature-detects/workers-dataworkers.js | 34 - .../feature-detects/workers-sharedworkers.js | 3 - .../bower_components/modernizr/grunt.js | 69 - .../modernizr/media/Modernizr 2 Logo.ai | 291 - .../modernizr/media/Modernizr 2 Logo.eps | Bin 350902 -> 0 bytes .../modernizr/media/Modernizr 2 Logo.png | Bin 14823 -> 0 bytes .../modernizr/media/Modernizr 2 Logo.svg | 35 - .../bower_components/modernizr/modernizr.js | 1406 -- .../bower_components/modernizr/readme.md | 28 - .../bower_components/requirejs/.bower.json | 27 - .../bower_components/requirejs/bower.json | 18 - .../bower_components/requirejs/require.js | 2129 -- .../build/es5src/drivers/indexeddb.js | 21 +- .../node_modules/localforage/component.json | 2 +- .../localforage/dist/localforage.js | 23 +- .../localforage/dist/localforage.min.js | 4 +- .../dist/localforage.nopromises.js | 23 +- .../dist/localforage.nopromises.min.js | 4 +- .../localforage/node_modules/lie/package.json | 2 +- .../node_modules/localforage/package.json | 12 +- .../localforage/src/drivers/indexeddb.js | 25 +- .../snippets/node_modules/lodash/package.json | 2 +- .../node_modules/loose-envify/package.json | 2 +- .../node_modules/lru-cache/package.json | 2 +- .../node_modules/media-typer/package.json | 2 +- .../merge-descriptors/package.json | 2 +- .../node_modules/methods/package.json | 2 +- docs/snippets/node_modules/mime-db/HISTORY.md | 19 + docs/snippets/node_modules/mime-db/db.json | 94 +- .../node_modules/mime-db/package.json | 34 +- .../node_modules/mime-types/HISTORY.md | 23 +- .../node_modules/mime-types/package.json | 24 +- docs/snippets/node_modules/mime/package.json | 2 +- .../node_modules/minimatch/package.json | 2 +- .../snippets/node_modules/mkdirp/package.json | 2 +- docs/snippets/node_modules/ms/package.json | 2 +- .../node_modules/neatjson/package.json | 2 +- .../node_modules/negotiator/package.json | 2 +- .../node_modules/object-assign/package.json | 2 +- .../node_modules/object-inspect/.eslintrc | 13 +- .../node_modules/object-inspect/CHANGELOG.md | 331 + .../node_modules/object-inspect/index.js | 11 +- .../node_modules/object-inspect/package.json | 54 +- .../object-inspect/readme.markdown | 2 +- .../object-inspect/test/bigint.js | 4 +- .../node_modules/object-inspect/test/fakes.js | 4 +- .../object-inspect/test/inspect.js | 36 +- .../object-inspect/test/toStringTag.js | 4 +- .../object-inspect/test/values.js | 3 +- .../node_modules/object-is/package.json | 2 +- .../node_modules/object-keys/package.json | 2 +- .../node_modules/object.assign/package.json | 2 +- .../node_modules/on-finished/package.json | 2 +- docs/snippets/node_modules/once/package.json | 2 +- .../node_modules/packet-reader/package.json | 2 +- docs/snippets/node_modules/pako/package.json | 2 +- .../node_modules/parseurl/package.json | 2 +- .../path-is-absolute/package.json | 2 +- .../node_modules/path-to-regexp/package.json | 2 +- .../path/node_modules/util/package.json | 2 +- docs/snippets/node_modules/path/package.json | 2 +- .../pg-connection-string/package.json | 2 +- .../node_modules/pg-int8/package.json | 2 +- docs/snippets/node_modules/pg-pool/index.js | 13 +- .../node_modules/pg-pool/package.json | 24 +- .../pg-pool/test/error-handling.js | 12 - .../pg-pool/test/idle-timeout-exit.js | 16 + .../node_modules/pg-pool/test/idle-timeout.js | 31 + .../node_modules/pg-pool/test/verify.js | 3 +- .../node_modules/pg-protocol/package.json | 2 +- .../node_modules/pg-types/package.json | 2 +- docs/snippets/node_modules/pg/lib/client.js | 8 + .../node_modules/pg/lib/connection.js | 8 + .../node_modules/pg/lib/native/client.js | 3 + docs/snippets/node_modules/pg/package.json | 16 +- .../snippets/node_modules/pgpass/package.json | 2 +- .../node_modules/postgres-array/package.json | 2 +- .../node_modules/postgres-bytea/package.json | 2 +- .../node_modules/postgres-date/package.json | 2 +- .../postgres-interval/package.json | 2 +- .../process-nextick-args/package.json | 2 +- .../node_modules/process/package.json | 2 +- .../node_modules/proxy-addr/package.json | 2 +- .../node_modules/pseudomap/package.json | 2 +- docs/snippets/node_modules/qs/package.json | 2 +- .../node_modules/range-parser/package.json | 2 +- .../node_modules/raw-body/package.json | 2 +- .../node_modules/readable-stream/package.json | 2 +- .../node_modules/redis-url/package.json | 2 +- docs/snippets/node_modules/redis/package.json | 2 +- .../node_modules/safe-buffer/package.json | 2 +- .../node_modules/safer-buffer/package.json | 2 +- .../send/node_modules/ms/package.json | 2 +- docs/snippets/node_modules/send/package.json | 2 +- .../node_modules/serve-static/package.json | 2 +- .../set-immediate-shim/package.json | 2 +- .../node_modules/setprototypeof/package.json | 2 +- .../node_modules/side-channel/.eslintignore | 1 + .../node_modules/side-channel/.eslintrc | 11 + .../side-channel/.github/FUNDING.yml | 12 + .../snippets/node_modules/side-channel/.nycrc | 13 + .../node_modules/side-channel/CHANGELOG.md | 65 + .../node_modules/side-channel/LICENSE | 21 + .../node_modules/side-channel/index.js | 124 + .../node_modules/side-channel/package.json | 95 + .../node_modules/side-channel/test/index.js | 78 + .../node_modules/readable-stream/package.json | 2 +- .../node_modules/safe-buffer/package.json | 2 +- .../node_modules/string_decoder/package.json | 2 +- .../snippets/node_modules/split2/package.json | 2 +- .../st/node_modules/mime/CHANGELOG.md | 7 + .../st/node_modules/mime/package.json | 24 +- .../st/node_modules/mime/types/other.js | 2 +- .../st/node_modules/mime/types/standard.js | 2 +- docs/snippets/node_modules/st/package.json | 2 +- .../node_modules/stack-trace/package.json | 2 +- .../node_modules/statuses/package.json | 2 +- .../node_modules/streamsearch/package.json | 2 +- .../string.prototype.trimend/package.json | 2 +- .../string.prototype.trimstart/package.json | 2 +- .../node_modules/string_decoder/package.json | 2 +- .../node_modules/toidentifier/package.json | 2 +- .../node_modules/traverse-chain/package.json | 2 +- .../node_modules/type-is/package.json | 2 +- .../node_modules/unbox-primitive/package.json | 2 +- .../snippets/node_modules/unpipe/package.json | 2 +- .../node_modules/util-deprecate/package.json | 2 +- docs/snippets/node_modules/util/package.json | 2 +- .../node_modules/utils-merge/package.json | 2 +- docs/snippets/node_modules/vary/package.json | 2 +- .../node_modules/vue-clickaway/package.json | 2 +- .../node_modules/vue-context/package.json | 2 +- docs/snippets/node_modules/vue/package.json | 2 +- .../which-boxed-primitive/package.json | 2 +- .../node_modules/which-typed-array/.eslintrc | 4 + .../which-typed-array/CHANGELOG.md | 31 +- .../node_modules/which-typed-array/index.js | 27 +- .../which-typed-array/package.json | 42 +- .../which-typed-array/test/index.js | 4 +- .../node_modules/winston/package.json | 2 +- .../snippets/node_modules/wrappy/package.json | 2 +- docs/snippets/node_modules/xtend/package.json | 2 +- .../node_modules/yallist/package.json | 2 +- 824 files changed, 23016 insertions(+), 38367 deletions(-) create mode 100644 docs/snippets/node_modules/codemirror/theme/juejin.css delete mode 100644 docs/snippets/node_modules/core-util-is/float.patch delete mode 100644 docs/snippets/node_modules/core-util-is/test.js delete mode 100644 docs/snippets/node_modules/es-abstract/.gitattributes create mode 100644 docs/snippets/node_modules/es-abstract/2015/CharacterRange.js create mode 100644 docs/snippets/node_modules/es-abstract/2015/IsCompatiblePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2016/CharacterRange.js create mode 100644 docs/snippets/node_modules/es-abstract/2016/IsCompatiblePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2017/CharacterRange.js create mode 100644 docs/snippets/node_modules/es-abstract/2017/IsCompatiblePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2017/IsSharedArrayBuffer.js create mode 100644 docs/snippets/node_modules/es-abstract/2017/OrdinaryToPrimitive.js create mode 100644 docs/snippets/node_modules/es-abstract/2018/CharacterRange.js create mode 100644 docs/snippets/node_modules/es-abstract/2018/IsCompatiblePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2018/IsSharedArrayBuffer.js create mode 100644 docs/snippets/node_modules/es-abstract/2018/OrdinaryToPrimitive.js create mode 100644 docs/snippets/node_modules/es-abstract/2019/CharacterRange.js create mode 100644 docs/snippets/node_modules/es-abstract/2019/IsCompatiblePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2019/IsSharedArrayBuffer.js create mode 100644 docs/snippets/node_modules/es-abstract/2019/OrdinaryToPrimitive.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/CharacterRange.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/CreateRegExpStringIterator.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/IsCompatiblePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/IsSharedArrayBuffer.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/OrdinaryToPrimitive.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/StringToBigInt.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/ToBigInt.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/ToBigInt64.js create mode 100644 docs/snippets/node_modules/es-abstract/2020/ToBigUint64.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/AbstractEqualityComparison.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/AbstractRelationalComparison.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/AddEntriesFromIterable.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/AddToKeptObjects.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/AdvanceStringIndex.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ApplyStringOrNumericBinaryOperator.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ArrayCreate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ArraySetLength.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ArraySpeciesCreate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/add.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseAND.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseNOT.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseOR.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseXOR.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/divide.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/equal.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/exponentiate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/index.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/leftShift.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/lessThan.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/multiply.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/remainder.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/sameValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/sameValueZero.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/signedRightShift.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/subtract.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/toString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/unaryMinus.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigInt/unsignedRightShift.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BigIntBitwiseOp.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BinaryAnd.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BinaryOr.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/BinaryXor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ByteListBitwiseOp.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ByteListEqual.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Call.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CanonicalNumericIndexString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CharacterRange.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ClearKeptObjects.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CodePointAt.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CodePointsToString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CompletePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CopyDataProperties.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CreateDataProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CreateDataPropertyOrThrow.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CreateHTML.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CreateIterResultObject.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CreateListFromArrayLike.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CreateMethodProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/CreateRegExpStringIterator.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/DateFromTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/DateString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Day.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/DayFromYear.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/DayWithinYear.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/DaysInYear.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/DefinePropertyOrThrow.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/DeletePropertyOrThrow.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/EnumerableOwnPropertyNames.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/FlattenIntoArray.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/FromPropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Get.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/GetIterator.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/GetMethod.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/GetOwnPropertyKeys.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/GetPromiseResolve.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/GetPrototypeFromConstructor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/GetSubstitution.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/GetV.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/HasOwnProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/HasProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/HourFromTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/InLeapYear.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/InstanceofOperator.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Invoke.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsAccessorDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsArray.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsBigIntElementType.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsCallable.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsCompatiblePropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsConcatSpreadable.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsConstructor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsDataDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsExtensible.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsGenericDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsIntegralNumber.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsNoTearConfiguration.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsPromise.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsPropertyKey.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsRegExp.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsSharedArrayBuffer.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsStringPrefix.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsUnclampedIntegerElementType.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IsUnsignedElementType.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IterableToList.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IteratorClose.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IteratorComplete.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IteratorNext.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IteratorStep.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/IteratorValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/LengthOfArrayLike.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/MakeDate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/MakeDay.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/MakeTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/MinFromTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/MonthFromTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/add.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/bitwiseAND.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/bitwiseNOT.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/bitwiseOR.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/bitwiseXOR.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/divide.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/equal.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/exponentiate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/index.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/leftShift.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/lessThan.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/multiply.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/remainder.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/sameValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/sameValueZero.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/signedRightShift.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/subtract.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/toString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/unaryMinus.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Number/unsignedRightShift.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/NumberBitwiseOp.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/NumberToBigInt.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryCreateFromConstructor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryDefineOwnProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryGetOwnProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryGetPrototypeOf.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryHasInstance.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryHasProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryObjectCreate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinarySetPrototypeOf.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/OrdinaryToPrimitive.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/PromiseResolve.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/QuoteJSONString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/RegExpCreate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/RegExpExec.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/RequireObjectCoercible.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SameValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SameValueNonNumeric.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SameValueZero.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SecFromTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Set.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SetFunctionLength.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SetFunctionName.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SetIntegrityLevel.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SpeciesConstructor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SplitMatch.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/StrictEqualityComparison.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/StringCreate.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/StringGetOwnProperty.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/StringIndexOf.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/StringPad.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/StringToBigInt.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/StringToCodePoints.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/SymbolDescriptiveString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/TestIntegrityLevel.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/TimeClip.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/TimeFromYear.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/TimeString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/TimeWithinDay.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToBigInt.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToBigInt64.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToBigUint64.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToBoolean.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToDateString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToIndex.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToInt16.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToInt32.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToInt8.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToIntegerOrInfinity.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToLength.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToNumber.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToNumeric.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToObject.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToPrimitive.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToPropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToPropertyKey.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToUint16.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToUint32.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToUint8.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ToUint8Clamp.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/TrimString.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/Type.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/UTF16EncodeCodePoint.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/UTF16SurrogatePairToCodePoint.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/UnicodeEscape.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/ValidateAndApplyPropertyDescriptor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/WeakRefDeref.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/WeekDay.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/YearFromTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/abs.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/clamp.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/floor.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/modulo.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/msFromTime.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/substring.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/thisBigIntValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/thisBooleanValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/thisNumberValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/thisStringValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/thisSymbolValue.js create mode 100644 docs/snippets/node_modules/es-abstract/2021/thisTimeValue.js create mode 100644 docs/snippets/node_modules/es-abstract/es2021.js create mode 100644 docs/snippets/node_modules/es-abstract/helpers/modBigInt.js create mode 100644 docs/snippets/node_modules/es-abstract/operations/2021.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/GetIntrinsic.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/diffOps.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es2015.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es2016.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es2017.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es2018.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es2019.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es2020.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es5.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es6.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/es7.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/OwnPropertyKeys.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/assertRecord.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/createBoundESNamespace.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/defineProperty.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/index.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/isByteValue.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/isCodePoint.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/helpers/runManifestTest.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/index.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/ses-compat.js delete mode 100644 docs/snippets/node_modules/es-abstract/test/tests.js create mode 100644 docs/snippets/node_modules/get-symbol-description/.eslintignore create mode 100644 docs/snippets/node_modules/get-symbol-description/.eslintrc create mode 100644 docs/snippets/node_modules/get-symbol-description/.github/FUNDING.yml create mode 100644 docs/snippets/node_modules/get-symbol-description/.nycrc create mode 100644 docs/snippets/node_modules/get-symbol-description/CHANGELOG.md create mode 100644 docs/snippets/node_modules/get-symbol-description/LICENSE create mode 100644 docs/snippets/node_modules/get-symbol-description/getInferredName.js create mode 100644 docs/snippets/node_modules/get-symbol-description/index.js create mode 100644 docs/snippets/node_modules/get-symbol-description/package.json rename docs/snippets/node_modules/{es-abstract/test/helpers/getSymbolDescription.js => get-symbol-description/test/index.js} (92%) delete mode 100644 docs/snippets/node_modules/glob/changelog.md create mode 100644 docs/snippets/node_modules/has-tostringtag/.eslintrc create mode 100644 docs/snippets/node_modules/has-tostringtag/.github/FUNDING.yml create mode 100644 docs/snippets/node_modules/has-tostringtag/CHANGELOG.md create mode 100644 docs/snippets/node_modules/has-tostringtag/LICENSE create mode 100644 docs/snippets/node_modules/has-tostringtag/index.js create mode 100644 docs/snippets/node_modules/has-tostringtag/package.json create mode 100644 docs/snippets/node_modules/has-tostringtag/shams.js create mode 100644 docs/snippets/node_modules/has-tostringtag/test/index.js create mode 100644 docs/snippets/node_modules/has-tostringtag/test/shams/core-js.js create mode 100644 docs/snippets/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js create mode 100644 docs/snippets/node_modules/has-tostringtag/test/tests.js rename docs/snippets/node_modules/{localforage/bower_components/modernizr => internal-slot}/.editorconfig (51%) create mode 100644 docs/snippets/node_modules/internal-slot/.eslintignore create mode 100644 docs/snippets/node_modules/internal-slot/.eslintrc create mode 100644 docs/snippets/node_modules/internal-slot/.github/FUNDING.yml create mode 100644 docs/snippets/node_modules/internal-slot/.nycrc create mode 100644 docs/snippets/node_modules/internal-slot/CHANGELOG.md create mode 100644 docs/snippets/node_modules/internal-slot/LICENSE create mode 100644 docs/snippets/node_modules/internal-slot/index.js create mode 100644 docs/snippets/node_modules/internal-slot/package.json create mode 100644 docs/snippets/node_modules/internal-slot/test/index.js delete mode 100644 docs/snippets/node_modules/is-bigint/test/.eslintrc delete mode 100644 docs/snippets/node_modules/is-callable/.github/main.workflow delete mode 100644 docs/snippets/node_modules/is-date-object/.jscs.json delete mode 100644 docs/snippets/node_modules/is-number-object/test/corejs.js create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/.eslintignore create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/.eslintrc create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/.github/FUNDING.yml create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/.nycrc create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/CHANGELOG.md create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/LICENSE create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/index.js create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/package.json create mode 100644 docs/snippets/node_modules/is-shared-array-buffer/test/index.js create mode 100644 docs/snippets/node_modules/is-weakref/.eslintignore create mode 100644 docs/snippets/node_modules/is-weakref/.eslintrc create mode 100644 docs/snippets/node_modules/is-weakref/.github/FUNDING.yml rename docs/snippets/node_modules/{is-arguments => is-weakref}/.github/workflows/node-4+.yml (100%) rename docs/snippets/node_modules/{is-arguments => is-weakref}/.github/workflows/node-iojs.yml (100%) rename docs/snippets/node_modules/{is-arguments => is-weakref}/.github/workflows/node-pretest.yml (100%) rename docs/snippets/node_modules/{is-arguments => is-weakref}/.github/workflows/node-zero.yml (100%) rename docs/snippets/node_modules/{is-arguments => is-weakref}/.github/workflows/rebase.yml (100%) rename docs/snippets/node_modules/{is-arguments => is-weakref}/.github/workflows/require-allow-edits.yml (100%) create mode 100644 docs/snippets/node_modules/is-weakref/.nycrc create mode 100644 docs/snippets/node_modules/is-weakref/CHANGELOG.md create mode 100644 docs/snippets/node_modules/is-weakref/LICENSE create mode 100644 docs/snippets/node_modules/is-weakref/index.js create mode 100644 docs/snippets/node_modules/is-weakref/package.json create mode 100644 docs/snippets/node_modules/is-weakref/test/index.js delete mode 100644 docs/snippets/node_modules/localforage/.tscache/typing_tests/timestamp delete mode 100644 docs/snippets/node_modules/localforage/bower_components/assert/.bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/assert/HISTORY.md delete mode 100644 docs/snippets/node_modules/localforage/bower_components/assert/assert.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/assert/bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/assert/package.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/es6-promise/.bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/es6-promise/bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/es6-promise/promise.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/es6-promise/promise.min.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/expect/.bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/expect/History.md delete mode 100644 docs/snippets/node_modules/localforage/bower_components/expect/index.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/expect/package.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/mocha/.bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/mocha/CHANGELOG.md delete mode 100644 docs/snippets/node_modules/localforage/bower_components/mocha/CONTRIBUTING.md delete mode 100644 docs/snippets/node_modules/localforage/bower_components/mocha/LICENSE delete mode 100644 docs/snippets/node_modules/localforage/bower_components/mocha/bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/mocha/mocha.css delete mode 100644 docs/snippets/node_modules/localforage/bower_components/mocha/mocha.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/.bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/a-download.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/audio-audiodata-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/audio-webaudio-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/battery-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/battery-level.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/blob-constructor.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/canvas-todataurl-type.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/contenteditable.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/contentsecuritypolicy.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/contextmenu.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/cookies.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/cors.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-backgroundposition-shorthand.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-backgroundposition-xy.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-backgroundrepeat.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-backgroundsizecover.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-boxsizing.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-calc.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-cubicbezierrange.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-displayrunin.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-displaytable.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-filters.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-hyphens.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-lastchild.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-mask.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-mediaqueries.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-objectfit.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-overflow-scrolling.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-pointerevents.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-positionsticky.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-regions.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-remunit.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-resize.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-scrollbars.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-shapes.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-subpixelfont.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-supports.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-userselect.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-vhunit.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-vmaxunit.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-vminunit.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/css-vwunit.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/custom-protocol-handler.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/dart.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/dataview-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/dom-classlist.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/dom-createElement-attrs.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/dom-dataset.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/dom-microdata.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/elem-datalist.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/elem-details.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/elem-output.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/elem-progress-meter.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/elem-ruby.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/elem-time.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/elem-track.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/emoji.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/es5-strictmode.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/event-deviceorientation-motion.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/exif-orientation.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/file-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/file-filesystem.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/forms-fileinput.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/forms-formattribute.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/forms-inputnumber-l10n.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/forms-placeholder.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/forms-speechinput.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/forms-validation.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/fullscreen-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/gamepad.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/getusermedia.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/ie8compat.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/iframe-sandbox.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/iframe-seamless.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/iframe-srcdoc.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/img-apng.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/img-webp.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/json.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/lists-reversed.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/mathml.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/network-connection.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/network-eventsource.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/network-xhr2.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/notification.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/performance.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/pointerlock-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/quota-management-api.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/requestanimationframe.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/script-async.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/script-defer.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/style-scoped.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/svg-filters.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/unicode.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/url-data-uri.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/userdata.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/vibration.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/web-intents.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/webgl-extensions.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/websockets-binary.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/window-framed.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/workers-blobworkers.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/workers-dataworkers.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/feature-detects/workers-sharedworkers.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/grunt.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/media/Modernizr 2 Logo.ai delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/media/Modernizr 2 Logo.eps delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/media/Modernizr 2 Logo.png delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/media/Modernizr 2 Logo.svg delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/modernizr.js delete mode 100644 docs/snippets/node_modules/localforage/bower_components/modernizr/readme.md delete mode 100644 docs/snippets/node_modules/localforage/bower_components/requirejs/.bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/requirejs/bower.json delete mode 100644 docs/snippets/node_modules/localforage/bower_components/requirejs/require.js create mode 100644 docs/snippets/node_modules/object-inspect/CHANGELOG.md create mode 100644 docs/snippets/node_modules/pg-pool/test/idle-timeout-exit.js create mode 100644 docs/snippets/node_modules/side-channel/.eslintignore create mode 100644 docs/snippets/node_modules/side-channel/.eslintrc create mode 100644 docs/snippets/node_modules/side-channel/.github/FUNDING.yml create mode 100644 docs/snippets/node_modules/side-channel/.nycrc create mode 100644 docs/snippets/node_modules/side-channel/CHANGELOG.md create mode 100644 docs/snippets/node_modules/side-channel/LICENSE create mode 100644 docs/snippets/node_modules/side-channel/index.js create mode 100644 docs/snippets/node_modules/side-channel/package.json create mode 100644 docs/snippets/node_modules/side-channel/test/index.js diff --git a/docs/snippets/node_modules/@corwin.amber/hastebin/package.json b/docs/snippets/node_modules/@corwin.amber/hastebin/package.json index c05590ca..48d59c29 100644 --- a/docs/snippets/node_modules/@corwin.amber/hastebin/package.json +++ b/docs/snippets/node_modules/@corwin.amber/hastebin/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/@corwin.amber/hastebin/-/hastebin-0.1.1.tgz", "_shasum": "5273df5db65443fbb0d6d588c89a3fdba19ef540", "_spec": "@corwin.amber/hastebin@^0.1.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "John Crepezzi", "email": "john.crepezzi@gmail.com", diff --git a/docs/snippets/node_modules/@jscoq/mathcomp/package.json b/docs/snippets/node_modules/@jscoq/mathcomp/package.json index 95de2ba3..4253f941 100644 --- a/docs/snippets/node_modules/@jscoq/mathcomp/package.json +++ b/docs/snippets/node_modules/@jscoq/mathcomp/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/@jscoq/mathcomp/-/mathcomp-0.12.3.tgz", "_shasum": "0b0ca50b9e3b2fcfb9ed7d9ae003b4b01ee0c0bf", "_spec": "@jscoq/mathcomp@^0.12.3", - "_where": "/home/gares/MATHCOMP/mcb/coq", + "_where": "/storage/current_data/mathcomp-book/1/coq", "bugs": { "url": "https://github.com/jscoq/addon-mathcomp/issues" }, diff --git a/docs/snippets/node_modules/accepts/package.json b/docs/snippets/node_modules/accepts/package.json index d988d02e..1a97f6de 100644 --- a/docs/snippets/node_modules/accepts/package.json +++ b/docs/snippets/node_modules/accepts/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", "_shasum": "531bc726517a3b2b41f850021c6cc15eaab507cd", "_spec": "accepts@~1.3.7", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "bugs": { "url": "https://github.com/jshttp/accepts/issues" }, diff --git a/docs/snippets/node_modules/array-equal/package.json b/docs/snippets/node_modules/array-equal/package.json index dee7b32d..b99e48b6 100644 --- a/docs/snippets/node_modules/array-equal/package.json +++ b/docs/snippets/node_modules/array-equal/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", "_shasum": "8c2a5ef2472fd9ea742b04c77a75093ba2757c93", "_spec": "array-equal@^1.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", diff --git a/docs/snippets/node_modules/array-flatten/package.json b/docs/snippets/node_modules/array-flatten/package.json index 133cfa76..30b1e7cd 100644 --- a/docs/snippets/node_modules/array-flatten/package.json +++ b/docs/snippets/node_modules/array-flatten/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "_shasum": "9a5f699051b1e7073328f2a008968b64ea2955d2", "_spec": "array-flatten@1.1.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "Blake Embrey", "email": "hello@blakeembrey.com", diff --git a/docs/snippets/node_modules/assert/package.json b/docs/snippets/node_modules/assert/package.json index 2982bb65..66cc89da 100644 --- a/docs/snippets/node_modules/assert/package.json +++ b/docs/snippets/node_modules/assert/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", "_shasum": "95fc1c616d48713510680f2eaf2d10dd22e02d32", "_spec": "assert@^2.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "bugs": { "url": "https://github.com/browserify/commonjs-assert/issues" }, diff --git a/docs/snippets/node_modules/async-cache/package.json b/docs/snippets/node_modules/async-cache/package.json index 1158295e..cf232e34 100644 --- a/docs/snippets/node_modules/async-cache/package.json +++ b/docs/snippets/node_modules/async-cache/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/async-cache/-/async-cache-1.1.0.tgz", "_shasum": "4a9a5a89d065ec5d8e5254bd9ee96ba76c532b5a", "_spec": "async-cache@^1.1.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/st", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/st", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", diff --git a/docs/snippets/node_modules/async/package.json b/docs/snippets/node_modules/async/package.json index 621b94aa..51f133ea 100644 --- a/docs/snippets/node_modules/async/package.json +++ b/docs/snippets/node_modules/async/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "_shasum": "f8fc04ca3a13784ade9e1641af98578cfbd647a9", "_spec": "async@~1.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/winston", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/winston", "author": { "name": "Caolan McMahon" }, diff --git a/docs/snippets/node_modules/available-typed-arrays/.eslintrc b/docs/snippets/node_modules/available-typed-arrays/.eslintrc index 3b5d9e90..62f1d7f5 100644 --- a/docs/snippets/node_modules/available-typed-arrays/.eslintrc +++ b/docs/snippets/node_modules/available-typed-arrays/.eslintrc @@ -2,4 +2,8 @@ "root": true, "extends": "@ljharb", + + "globals": { + "globalThis": false + } } diff --git a/docs/snippets/node_modules/available-typed-arrays/CHANGELOG.md b/docs/snippets/node_modules/available-typed-arrays/CHANGELOG.md index 642bc3a9..112aff96 100644 --- a/docs/snippets/node_modules/available-typed-arrays/CHANGELOG.md +++ b/docs/snippets/node_modules/available-typed-arrays/CHANGELOG.md @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.0.5](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.4...v1.0.5) - 2021-08-30 + +### Fixed + +- [Refactor] use `globalThis` if available [`#12`](https://github.com/inspect-js/available-typed-arrays/issues/12) + +### Commits + +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`1199790`](https://github.com/inspect-js/available-typed-arrays/commit/1199790ab5841517ad04827fab3f135d2dc5cfb7) + ## [v1.0.4](https://github.com/inspect-js/available-typed-arrays/compare/v1.0.3...v1.0.4) - 2021-05-25 ### Commits diff --git a/docs/snippets/node_modules/available-typed-arrays/index.js b/docs/snippets/node_modules/available-typed-arrays/index.js index 00cb9c16..88dbac3f 100644 --- a/docs/snippets/node_modules/available-typed-arrays/index.js +++ b/docs/snippets/node_modules/available-typed-arrays/index.js @@ -14,10 +14,12 @@ var possibleNames = [ 'Uint8ClampedArray' ]; +var g = typeof globalThis === 'undefined' ? global : globalThis; + module.exports = function availableTypedArrays() { var out = []; for (var i = 0; i < possibleNames.length; i++) { - if (typeof global[possibleNames[i]] === 'function') { + if (typeof g[possibleNames[i]] === 'function') { out[out.length] = possibleNames[i]; } } diff --git a/docs/snippets/node_modules/available-typed-arrays/package.json b/docs/snippets/node_modules/available-typed-arrays/package.json index d86002d0..ac35bf6a 100644 --- a/docs/snippets/node_modules/available-typed-arrays/package.json +++ b/docs/snippets/node_modules/available-typed-arrays/package.json @@ -1,28 +1,28 @@ { - "_from": "available-typed-arrays@^1.0.2", - "_id": "available-typed-arrays@1.0.4", + "_from": "available-typed-arrays@^1.0.5", + "_id": "available-typed-arrays@1.0.5", "_inBundle": false, - "_integrity": "sha512-SA5mXJWrId1TaQjfxUYghbqQ/hYioKmLJvPJyDuYRtXXenFNMjj4hSSt1Cf1xsuXSXrtxrVC5Ot4eU6cOtBDdA==", + "_integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "_location": "/available-typed-arrays", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "available-typed-arrays@^1.0.2", + "raw": "available-typed-arrays@^1.0.5", "name": "available-typed-arrays", "escapedName": "available-typed-arrays", - "rawSpec": "^1.0.2", + "rawSpec": "^1.0.5", "saveSpec": null, - "fetchSpec": "^1.0.2" + "fetchSpec": "^1.0.5" }, "_requiredBy": [ "/is-typed-array", "/which-typed-array" ], - "_resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.4.tgz", - "_shasum": "9e0ae84ecff20caae6a94a1c3bc39b955649b7a9", - "_spec": "available-typed-arrays@^1.0.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/is-typed-array", + "_resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "_shasum": "92f95616501069d07d10edb2fc37d3e1c65123b7", + "_spec": "available-typed-arrays@^1.0.5", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/is-typed-array", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" @@ -42,16 +42,16 @@ "deprecated": false, "description": "Returns an array of Typed Array names that are available in the current environment", "devDependencies": { - "@ljharb/eslint-config": "^17.6.0", + "@ljharb/eslint-config": "^18.0.0", "array.prototype.every": "^1.1.2", "aud": "^1.1.5", "auto-changelog": "^2.3.0", - "eslint": "^7.27.0", + "eslint": "^7.32.0", "evalmd": "^0.0.19", "isarray": "^2.0.5", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.1" }, "engines": { "node": ">= 0.4" @@ -107,5 +107,5 @@ }, "sideEffects": false, "type": "commonjs", - "version": "1.0.4" + "version": "1.0.5" } diff --git a/docs/snippets/node_modules/balanced-match/package.json b/docs/snippets/node_modules/balanced-match/package.json index cb949972..931e1a78 100644 --- a/docs/snippets/node_modules/balanced-match/package.json +++ b/docs/snippets/node_modules/balanced-match/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "_shasum": "e83e3a7e3f300b34cb9d87f615fa0cbf357690ee", "_spec": "balanced-match@^1.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/brace-expansion", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/brace-expansion", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", diff --git a/docs/snippets/node_modules/base64-js/package.json b/docs/snippets/node_modules/base64-js/package.json index b7b69c41..626f2a34 100644 --- a/docs/snippets/node_modules/base64-js/package.json +++ b/docs/snippets/node_modules/base64-js/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "_shasum": "1b1b440160a5bf7ad40b650f095963481903930a", "_spec": "base64-js@^1.3.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/buffer", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/buffer", "author": { "name": "T. Jameson Little", "email": "t.jameson.little@gmail.com" diff --git a/docs/snippets/node_modules/bl/node_modules/inherits/package.json b/docs/snippets/node_modules/bl/node_modules/inherits/package.json index 2e1910f3..dfbd10d9 100644 --- a/docs/snippets/node_modules/bl/node_modules/inherits/package.json +++ b/docs/snippets/node_modules/bl/node_modules/inherits/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "_shasum": "0fa2c64f932917c3433a0ded55363aae37416b7c", "_spec": "inherits@^2.0.4", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/bl", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/bl", "browser": "./inherits_browser.js", "bugs": { "url": "https://github.com/isaacs/inherits/issues" diff --git a/docs/snippets/node_modules/bl/node_modules/readable-stream/package.json b/docs/snippets/node_modules/bl/node_modules/readable-stream/package.json index e0a79ec3..a56e0133 100644 --- a/docs/snippets/node_modules/bl/node_modules/readable-stream/package.json +++ b/docs/snippets/node_modules/bl/node_modules/readable-stream/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "_shasum": "337bbda3adc0706bd3e024426a286d4b4b2c9198", "_spec": "readable-stream@^3.4.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/bl", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/bl", "browser": { "util": false, "worker_threads": false, diff --git a/docs/snippets/node_modules/bl/node_modules/safe-buffer/package.json b/docs/snippets/node_modules/bl/node_modules/safe-buffer/package.json index b8f67aec..d00b740e 100644 --- a/docs/snippets/node_modules/bl/node_modules/safe-buffer/package.json +++ b/docs/snippets/node_modules/bl/node_modules/safe-buffer/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "_shasum": "1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6", "_spec": "safe-buffer@~5.2.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/bl/node_modules/string_decoder", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/bl/node_modules/string_decoder", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", diff --git a/docs/snippets/node_modules/bl/node_modules/string_decoder/package.json b/docs/snippets/node_modules/bl/node_modules/string_decoder/package.json index cab1eaba..cfba2406 100644 --- a/docs/snippets/node_modules/bl/node_modules/string_decoder/package.json +++ b/docs/snippets/node_modules/bl/node_modules/string_decoder/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "_shasum": "42f114594a46cf1a8e30b0a84f56c78c3edac21e", "_spec": "string_decoder@^1.1.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/bl/node_modules/readable-stream", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/bl/node_modules/readable-stream", "bugs": { "url": "https://github.com/nodejs/string_decoder/issues" }, diff --git a/docs/snippets/node_modules/bl/package.json b/docs/snippets/node_modules/bl/package.json index 0919093b..34482b1c 100644 --- a/docs/snippets/node_modules/bl/package.json +++ b/docs/snippets/node_modules/bl/package.json @@ -23,7 +23,7 @@ "_resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "_shasum": "451535264182bec2fbbc83a62ab98cf11d9f7b3a", "_spec": "bl@^4.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/st", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/st", "authors": [ "Rod Vagg (https://github.com/rvagg)", "Matteo Collina (https://github.com/mcollina)", diff --git a/docs/snippets/node_modules/body-parser/package.json b/docs/snippets/node_modules/body-parser/package.json index 796ae752..00e5f04a 100644 --- a/docs/snippets/node_modules/body-parser/package.json +++ b/docs/snippets/node_modules/body-parser/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", "_shasum": "96b2709e57c9c4e09a6fd66a8fd979844f69f08a", "_spec": "body-parser@1.19.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "bugs": { "url": "https://github.com/expressjs/body-parser/issues" }, diff --git a/docs/snippets/node_modules/bootstrap/package.json b/docs/snippets/node_modules/bootstrap/package.json index fa53e870..a99f42d8 100644 --- a/docs/snippets/node_modules/bootstrap/package.json +++ b/docs/snippets/node_modules/bootstrap/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.4.1.tgz", "_shasum": "c3a347d419e289ad11f4033e3c4132b87c081d72", "_spec": "bootstrap@^3.4.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "Twitter, Inc." }, diff --git a/docs/snippets/node_modules/brace-expansion/package.json b/docs/snippets/node_modules/brace-expansion/package.json index a60130ed..3b933209 100644 --- a/docs/snippets/node_modules/brace-expansion/package.json +++ b/docs/snippets/node_modules/brace-expansion/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "_shasum": "3c7fcbf529d87226f3d2f52b966ff5271eb441dd", "_spec": "brace-expansion@^1.1.7", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/minimatch", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/minimatch", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", diff --git a/docs/snippets/node_modules/buffer-writer/package.json b/docs/snippets/node_modules/buffer-writer/package.json index 8e211f4f..0e6d6da9 100644 --- a/docs/snippets/node_modules/buffer-writer/package.json +++ b/docs/snippets/node_modules/buffer-writer/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", "_shasum": "ce7eb81a38f7829db09c873f2fbb792c0c98ec04", "_spec": "buffer-writer@2.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/pg", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/pg", "author": { "name": "Brian M. Carlson" }, diff --git a/docs/snippets/node_modules/buffer/package.json b/docs/snippets/node_modules/buffer/package.json index 492963c7..1818d24e 100644 --- a/docs/snippets/node_modules/buffer/package.json +++ b/docs/snippets/node_modules/buffer/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "_shasum": "ba62e7c13133053582197160851a8f648e99eed0", "_spec": "buffer@^5.5.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/bl", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/bl", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", diff --git a/docs/snippets/node_modules/busboy/package.json b/docs/snippets/node_modules/busboy/package.json index 69f43c00..8d22e098 100644 --- a/docs/snippets/node_modules/busboy/package.json +++ b/docs/snippets/node_modules/busboy/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.4.tgz", "_shasum": "1977e96e1ee884649651ebdf548ca900758ba7f3", "_spec": "busboy@0.2.4", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/@corwin.amber/hastebin", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/@corwin.amber/hastebin", "author": { "name": "Brian White", "email": "mscdex@mscdex.net" diff --git a/docs/snippets/node_modules/bytes/package.json b/docs/snippets/node_modules/bytes/package.json index 1a1f564b..167b7f33 100644 --- a/docs/snippets/node_modules/bytes/package.json +++ b/docs/snippets/node_modules/bytes/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", "_shasum": "f6cf7933a360e0588fa9fde85651cdc7f805d1f6", "_spec": "bytes@3.1.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/body-parser", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/body-parser", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", diff --git a/docs/snippets/node_modules/call-bind/package.json b/docs/snippets/node_modules/call-bind/package.json index 85d3e329..f81d9d20 100644 --- a/docs/snippets/node_modules/call-bind/package.json +++ b/docs/snippets/node_modules/call-bind/package.json @@ -17,13 +17,16 @@ }, "_requiredBy": [ "/es-abstract", + "/get-symbol-description", "/is-arguments", "/is-boolean-object", "/is-nan", "/is-regex", "/is-typed-array", + "/is-weakref", "/object-is", "/object.assign", + "/side-channel", "/string.prototype.trimend", "/string.prototype.trimstart", "/which-typed-array" @@ -31,7 +34,7 @@ "_resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "_shasum": "b1d4e89e688119c3c9a903ad30abb2f6a919be3c", "_spec": "call-bind@^1.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/is-nan", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/is-nan", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" diff --git a/docs/snippets/node_modules/codemirror/AUTHORS b/docs/snippets/node_modules/codemirror/AUTHORS index a8ded264..3da7e5ad 100644 --- a/docs/snippets/node_modules/codemirror/AUTHORS +++ b/docs/snippets/node_modules/codemirror/AUTHORS @@ -21,6 +21,7 @@ Adrien Bertrand aeroson Ahmad Amireh Ahmad M. Zawawi +AHOHNMYC ahoward Ajin Abraham Akeksandr Motsjonov @@ -77,8 +78,10 @@ Anthony Dugois anthonygego Anthony Gégo Anthony Grimes +Anthony Stewart Anton Kovalyov antosarho +aoki ken Apollo Zhu AQNOUCH Mohammed Aram Shatakhtsyan @@ -116,6 +119,7 @@ Bernhard Sirlinger Bert Chang Bharad BigBlueHat +Billiam Billy Moon Bin Ni binny @@ -165,6 +169,7 @@ Chris Smith Christian Gruen Christian Oyarzun Christian Petrov +Christian Sonne christopherblaser Christopher Brown Christopher Kramer @@ -226,6 +231,7 @@ Dick Choi Diego Fernandez dignifiedquire Dimage Sapelkin +Dimitri Mitropoulos Dinindu D. Wanniarachchi dmaclach Dmitry Kiselyov @@ -369,6 +375,7 @@ Jack Douglas Jacob Lee Jaimin Jake Peyser +Jake Zimmerman Jakob Kummerow Jakob Miland Jakub T. Jankiewicz @@ -427,6 +434,7 @@ John Engler John Lees-Miller John Ryan John Snelson +johnspiegel John Van Der Loo Jon Ander Peñalba Jonas Döbertin @@ -465,6 +473,7 @@ karevn Karol Kaushik Kulkarni Kayur Patel +Kazuhisa Ishizaka Kazuhito Hokamura kcwiakala Kees de Kooter @@ -504,6 +513,7 @@ Leo Baschy Leonid Khachaturov Leon Sorokin Leonya Khachaturov +lexer2086 Liam Newman Libo Cannici Lior Goldberg @@ -618,6 +628,7 @@ Mike Ivanov Mike Kadin Mike Kobit Milan Szekely +MinJune Kim MinRK Miraculix87 misfo @@ -632,6 +643,7 @@ ms mtaran-google Mu-An âœŒï¸ Chiou Mu-An Chiou +Mykola Martynovets mzabuawala Narciso Jaramillo nathanlesage @@ -669,6 +681,7 @@ Norman Rzepka Nouzbe Oleksandr Yakovenko Olivia Ytterbrink +OndÅ™ej Mirtes Opender Singh opl- Oreoluwa Onatemowo @@ -720,6 +733,7 @@ Prasanth J Prayag Verma prendota Prendota +ps173 Qiang Li quiddity-wp Radek Piórkowski @@ -753,8 +767,10 @@ Roberto Vidal Robert Plummer Roman Frolov Roman Janusz +Rongjian Zhang Rrandom Rrrandom +Ruslan Bekenev Ruslan Osmanov rvalavicius Ryan Pangrle @@ -762,6 +778,7 @@ Ryan Petrello Ryan Prior ryu-sato sabaca +Sachin Gupta Sam Lee Sam Rawlins Samuel Ainsworth @@ -816,6 +833,7 @@ srajanpaliwal Stanislav Oaserele stan-z Stas Kobzar +stasoid Stefan Borsje Steffen Beyer Steffen Bruchmann @@ -824,6 +842,7 @@ Stephane Moore Stephen Lavelle Steve Champagne Steve Hoover +Steven Yung Steve O'Hara stockiNail stoskov @@ -903,7 +922,9 @@ Wes Cossick Wesley Wiser Weston Ruter Will Binns-Smith +Will Cassella Will Dean +Will Hernandez William Desportes William Jamieson William Stein diff --git a/docs/snippets/node_modules/codemirror/CHANGELOG.md b/docs/snippets/node_modules/codemirror/CHANGELOG.md index 4145ff47..619a8598 100644 --- a/docs/snippets/node_modules/codemirror/CHANGELOG.md +++ b/docs/snippets/node_modules/codemirror/CHANGELOG.md @@ -1,3 +1,81 @@ +## 5.64.0 (2021-11-20) + +### Bug fixes + +Fix a crash that occurred in some situations with replacing marks across line breaks. + +Make sure native scrollbars reset their position when hidden and re-shown. + +### New features + +[vim bindings](https://codemirror.net/demo/vim.html): Support C-u to delete back a line. + +## 5.63.3 (2021-10-11) + +### Bug fixes + +Prevent external styles from giving the hidden textarea a min-height. + +Remove a stray autosave file that was part of the previous release. + +## 5.63.1 (2021-09-29) + +### Bug fixes + +Fix an issue with mouse scrolling on Chrome 94 Windows, which made scrolling by wheel move unusably slow. + +## 5.63.0 (2021-09-20) + +### Bug fixes + +Fix scroll position jumping when scrolling a document with very different line heights. + +[xml mode](https://codemirror.net/mode/xml/): Look up HTML element behavior in a case-insensitive way. + +### New features + +[vim bindings](https://codemirror.net/demo/vim.html): Support guu for case-changing. + +## 5.62.3 (2021-08-20) + +### Bug fixes + +Give the editor a `translate=no` attribute to prevent automatic translation from modifying its content. + +Give vim-style cursors a width that matches the character after them. + +[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Make buttons keyboard-accessible. + +[emacs bindings](https://codemirror.net/demo/emacs.html): Fix by-page scrolling keybindings, which were accidentally inverted. + +## 5.62.2 (2021-07-21) + +### Bug fixes + +[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Fix a regression that broke several addon options. + +## 5.62.1 (2021-07-20) + +### Bug fixes + +[vim bindings](https://codemirror.net/demo/vim.html): Make matching of upper-case characters more Unicode-aware. + +[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Prevent options passed to the addon itself from being given to the linter. + +[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Improve screen reader support. + +[search addon](https://codemirror.net/demo/search.html): Avoid using `innerHTML`. + +## 5.62.0 (2021-06-21) + +### Bug fixes + +Improve support for vim-style cursors in a number of themes. + +### New features + +[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Add support for highlighting lines with errors or warnings. + ## 5.61.1 (2021-05-20) ### Bug fixes diff --git a/docs/snippets/node_modules/codemirror/addon/fold/foldcode.js b/docs/snippets/node_modules/codemirror/addon/fold/foldcode.js index 887df3fe..721bc087 100644 --- a/docs/snippets/node_modules/codemirror/addon/fold/foldcode.js +++ b/docs/snippets/node_modules/codemirror/addon/fold/foldcode.js @@ -24,9 +24,11 @@ function getRange(allowFolded) { var range = finder(cm, pos); if (!range || range.to.line - range.from.line < minSize) return null; + if (force === "fold") return range; + var marks = cm.findMarksAt(range.from); for (var i = 0; i < marks.length; ++i) { - if (marks[i].__isFold && force !== "fold") { + if (marks[i].__isFold) { if (!allowFolded) return null; range.cleared = true; marks[i].clear(); @@ -99,18 +101,18 @@ cm.foldCode(cm.getCursor(), null, "fold"); }; CodeMirror.commands.unfold = function(cm) { - cm.foldCode(cm.getCursor(), null, "unfold"); + cm.foldCode(cm.getCursor(), { scanUp: false }, "unfold"); }; CodeMirror.commands.foldAll = function(cm) { cm.operation(function() { for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "fold"); + cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "fold"); }); }; CodeMirror.commands.unfoldAll = function(cm) { cm.operation(function() { for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) - cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold"); + cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "unfold"); }); }; diff --git a/docs/snippets/node_modules/codemirror/addon/hint/show-hint.js b/docs/snippets/node_modules/codemirror/addon/hint/show-hint.js index 8f236562..2be2c716 100644 --- a/docs/snippets/node_modules/codemirror/addon/hint/show-hint.js +++ b/docs/snippets/node_modules/codemirror/addon/hint/show-hint.js @@ -224,6 +224,7 @@ } function Widget(completion, data) { + this.id = "cm-complete-" + Math.floor(Math.random(1e6)) this.completion = completion; this.data = data; this.picked = false; @@ -232,6 +233,9 @@ var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow; var hints = this.hints = ownerDocument.createElement("ul"); + hints.setAttribute("role", "listbox") + hints.setAttribute("aria-expanded", "true") + hints.id = this.id var theme = completion.cm.options.theme; hints.className = "CodeMirror-hints " + theme; this.selectedHint = data.selectedHint || 0; @@ -242,6 +246,9 @@ var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS); if (cur.className != null) className = cur.className + " " + className; elt.className = className; + if (i == this.selectedHint) elt.setAttribute("aria-selected", "true") + elt.id = this.id + "-" + i + elt.setAttribute("role", "option") if (cur.render) cur.render(elt, data, cur); else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur))); elt.hintId = i; @@ -267,6 +274,9 @@ var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth); var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight); container.appendChild(hints); + cm.getInputField().setAttribute("aria-autocomplete", "list") + cm.getInputField().setAttribute("aria-owns", this.id) + cm.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint) var box = completion.options.moveOnOverlap ? hints.getBoundingClientRect() : new DOMRect(); var scrolls = completion.options.paddingForScrollbar ? hints.scrollHeight > hints.clientHeight + 1 : false; @@ -364,6 +374,9 @@ this.completion.widget = null; if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints); this.completion.cm.removeKeyMap(this.keyMap); + var input = this.completion.cm.getInputField() + input.removeAttribute("aria-activedescendant") + input.removeAttribute("aria-owns") var cm = this.completion.cm; if (this.completion.options.closeOnUnfocus) { @@ -391,9 +404,14 @@ i = avoidWrap ? 0 : this.data.list.length - 1; if (this.selectedHint == i) return; var node = this.hints.childNodes[this.selectedHint]; - if (node) node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); + if (node) { + node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, ""); + node.removeAttribute("aria-selected") + } node = this.hints.childNodes[this.selectedHint = i]; node.className += " " + ACTIVE_HINT_ELEMENT_CLASS; + node.setAttribute("aria-selected", "true") + this.completion.cm.getInputField().setAttribute("aria-activedescendant", node.id) this.scrollToActive() CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node); }, diff --git a/docs/snippets/node_modules/codemirror/addon/lint/lint.css b/docs/snippets/node_modules/codemirror/addon/lint/lint.css index 08718659..e1560db9 100644 --- a/docs/snippets/node_modules/codemirror/addon/lint/lint.css +++ b/docs/snippets/node_modules/codemirror/addon/lint/lint.css @@ -69,3 +69,11 @@ background-position: right bottom; width: 100%; height: 100%; } + +.CodeMirror-lint-line-error { + background-color: rgba(183, 76, 81, 0.08); +} + +.CodeMirror-lint-line-warning { + background-color: rgba(255, 211, 0, 0.1); +} diff --git a/docs/snippets/node_modules/codemirror/addon/lint/lint.js b/docs/snippets/node_modules/codemirror/addon/lint/lint.js index 395f0d93..1613deb9 100644 --- a/docs/snippets/node_modules/codemirror/addon/lint/lint.js +++ b/docs/snippets/node_modules/codemirror/addon/lint/lint.js @@ -11,6 +11,7 @@ })(function(CodeMirror) { "use strict"; var GUTTER_ID = "CodeMirror-lint-markers"; + var LINT_LINE_ID = "CodeMirror-lint-line-"; function showTooltip(cm, e, content) { var tt = document.createElement("div"); @@ -58,29 +59,54 @@ CodeMirror.on(node, "mouseout", hide); } - function LintState(cm, options, hasGutter) { + function LintState(cm, conf, hasGutter) { this.marked = []; - this.options = options; + if (conf instanceof Function) conf = {getAnnotations: conf}; + if (!conf || conf === true) conf = {}; + this.options = {}; + this.linterOptions = conf.options || {}; + for (var prop in defaults) this.options[prop] = defaults[prop]; + for (var prop in conf) { + if (defaults.hasOwnProperty(prop)) { + if (conf[prop] != null) this.options[prop] = conf[prop]; + } else if (!conf.options) { + this.linterOptions[prop] = conf[prop]; + } + } this.timeout = null; this.hasGutter = hasGutter; this.onMouseOver = function(e) { onMouseOver(cm, e); }; this.waitingFor = 0 } - function parseOptions(_cm, options) { - if (options instanceof Function) return {getAnnotations: options}; - if (!options || options === true) options = {}; - return options; + var defaults = { + highlightLines: false, + tooltips: true, + delay: 500, + lintOnChange: true, + getAnnotations: null, + async: false, + selfContain: null, + formatAnnotation: null, + onUpdateLinting: null } function clearMarks(cm) { var state = cm.state.lint; if (state.hasGutter) cm.clearGutter(GUTTER_ID); + if (state.options.highlightLines) clearErrorLines(cm); for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear(); state.marked.length = 0; } + function clearErrorLines(cm) { + cm.eachLine(function(line) { + var has = line.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(line.wrapClass); + if (has) cm.removeLineClass(line, "wrap", has[0]); + }) + } + function makeMarker(cm, labels, severity, multiple, tooltips) { var marker = document.createElement("div"), inner = marker; marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity; @@ -123,7 +149,7 @@ return tip; } - function lintAsync(cm, getAnnotations, passOptions) { + function lintAsync(cm, getAnnotations) { var state = cm.state.lint var id = ++state.waitingFor function abort() { @@ -136,22 +162,23 @@ if (state.waitingFor != id) return if (arg2 && annotations instanceof CodeMirror) annotations = arg2 cm.operation(function() {updateLinting(cm, annotations)}) - }, passOptions, cm); + }, state.linterOptions, cm); } function startLinting(cm) { - var state = cm.state.lint, options = state.options; + var state = cm.state.lint; + if (!state) return; + var options = state.options; /* * Passing rules in `options` property prevents JSHint (and other linters) from complaining * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc. */ - var passOptions = options.options || options; var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); if (!getAnnotations) return; if (options.async || getAnnotations.async) { - lintAsync(cm, getAnnotations, passOptions) + lintAsync(cm, getAnnotations) } else { - var annotations = getAnnotations(cm.getValue(), passOptions, cm); + var annotations = getAnnotations(cm.getValue(), state.linterOptions, cm); if (!annotations) return; if (annotations.then) annotations.then(function(issues) { cm.operation(function() {updateLinting(cm, issues)}) @@ -161,8 +188,10 @@ } function updateLinting(cm, annotationsNotSorted) { + var state = cm.state.lint; + if (!state) return; + var options = state.options; clearMarks(cm); - var state = cm.state.lint, options = state.options; var annotations = groupByLine(annotationsNotSorted); @@ -194,7 +223,10 @@ // use original annotations[line] to show multiple messages if (state.hasGutter) cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, annotations[line].length > 1, - state.options.tooltips)); + options.tooltips)); + + if (options.highlightLines) + cm.addLineClass(line, "wrap", LINT_LINE_ID + maxSeverity); } if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm); } @@ -203,7 +235,7 @@ var state = cm.state.lint; if (!state) return; clearTimeout(state.timeout); - state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); + state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay); } function popupTooltips(cm, annotations, e) { @@ -243,8 +275,8 @@ if (val) { var gutters = cm.getOption("gutters"), hasLintGutter = false; for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true; - var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter); - if (state.options.lintOnChange !== false) + var state = cm.state.lint = new LintState(cm, val, hasLintGutter); + if (state.options.lintOnChange) cm.on("change", onChange); if (state.options.tooltips != false && state.options.tooltips != "gutter") CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver); @@ -254,6 +286,6 @@ }); CodeMirror.defineExtension("performLint", function() { - if (this.state.lint) startLinting(this); + startLinting(this); }); }); diff --git a/docs/snippets/node_modules/codemirror/addon/merge/merge.js b/docs/snippets/node_modules/codemirror/addon/merge/merge.js index 827edb71..7fd963f7 100644 --- a/docs/snippets/node_modules/codemirror/addon/merge/merge.js +++ b/docs/snippets/node_modules/codemirror/addon/merge/merge.js @@ -508,6 +508,7 @@ copy.title = dv.edit.phrase(editOriginals ? "Push to left" : "Revert chunk"); copy.chunk = chunk; copy.style.top = (chunk.origTo > chunk.origFrom ? top : dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit) + "px"; + copy.setAttribute("role", "button"); if (editOriginals) { var topReverse = dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit; @@ -518,6 +519,7 @@ origFrom: chunk.editFrom, origTo: chunk.editTo}; copyReverse.style.top = topReverse + "px"; dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px"; + copyReverse.setAttribute("role", "button"); } } } @@ -599,6 +601,7 @@ function buildGap(dv) { var lock = dv.lockButton = elt("div", null, "CodeMirror-merge-scrolllock"); + lock.setAttribute("role", "button"); var lockWrap = elt("div", [lock], "CodeMirror-merge-scrolllock-wrap"); CodeMirror.on(lock, "click", function() { setScrollLock(dv, !dv.lockScroll); }); var gapElts = [lockWrap]; diff --git a/docs/snippets/node_modules/codemirror/addon/search/search.js b/docs/snippets/node_modules/codemirror/addon/search/search.js index 118f1112..24a0855e 100644 --- a/docs/snippets/node_modules/codemirror/addon/search/search.js +++ b/docs/snippets/node_modules/codemirror/addon/search/search.js @@ -189,18 +189,43 @@ if (state.annotate) { state.annotate.clear(); state.annotate = null; } });} + function el(tag, attrs) { + var element = tag ? document.createElement(tag) : document.createDocumentFragment(); + for (var key in attrs) { + element[key] = attrs[key]; + } + for (var i = 2; i < arguments.length; i++) { + var child = arguments[i] + element.appendChild(typeof child == "string" ? document.createTextNode(child) : child); + } + return element; + } function getQueryDialog(cm) { - return '' + cm.phrase("Search:") + ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; + return el("", null, + el("span", {className: "CodeMirror-search-label"}, cm.phrase("Search:")), " ", + el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}), " ", + el("span", {style: "color: #888", className: "CodeMirror-search-hint"}, + cm.phrase("(Use /re/ syntax for regexp search)"))); } function getReplaceQueryDialog(cm) { - return ' ' + cm.phrase("(Use /re/ syntax for regexp search)") + ''; + return el("", null, " ", + el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}), " ", + el("span", {style: "color: #888", className: "CodeMirror-search-hint"}, + cm.phrase("(Use /re/ syntax for regexp search)"))); } function getReplacementQueryDialog(cm) { - return '' + cm.phrase("With:") + ' '; + return el("", null, + el("span", {className: "CodeMirror-search-label"}, cm.phrase("With:")), " ", + el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"})); } function getDoReplaceConfirm(cm) { - return '' + cm.phrase("Replace?") + ' '; + return el("", null, + el("span", {className: "CodeMirror-search-label"}, cm.phrase("Replace?")), " ", + el("button", {}, cm.phrase("Yes")), " ", + el("button", {}, cm.phrase("No")), " ", + el("button", {}, cm.phrase("All")), " ", + el("button", {}, cm.phrase("Stop"))); } function replaceAll(cm, query, text) { @@ -217,8 +242,11 @@ function replace(cm, all) { if (cm.getOption("readOnly")) return; var query = cm.getSelection() || getSearchState(cm).lastQuery; - var dialogText = '' + (all ? cm.phrase("Replace all:") : cm.phrase("Replace:")) + ''; - dialog(cm, dialogText + getReplaceQueryDialog(cm), dialogText, query, function(query) { + var dialogText = all ? cm.phrase("Replace all:") : cm.phrase("Replace:") + var fragment = el("", null, + el("span", {className: "CodeMirror-search-label"}, dialogText), + getReplaceQueryDialog(cm)) + dialog(cm, fragment, dialogText, query, function(query) { if (!query) return; query = parseQuery(query); dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) { diff --git a/docs/snippets/node_modules/codemirror/addon/search/searchcursor.js b/docs/snippets/node_modules/codemirror/addon/search/searchcursor.js index d5869578..230017b7 100644 --- a/docs/snippets/node_modules/codemirror/addon/search/searchcursor.js +++ b/docs/snippets/node_modules/codemirror/addon/search/searchcursor.js @@ -202,6 +202,7 @@ function SearchCursor(doc, query, pos, options) { this.atOccurrence = false + this.afterEmptyMatch = false this.doc = doc pos = pos ? doc.clipPos(pos) : Pos(0, 0) this.pos = {from: pos, to: pos} @@ -237,21 +238,29 @@ findPrevious: function() {return this.find(true)}, find: function(reverse) { - var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to)) - - // Implements weird auto-growing behavior on null-matches for - // backwards-compatibility with the vim code (unfortunately) - while (result && CodeMirror.cmpPos(result.from, result.to) == 0) { + var head = this.doc.clipPos(reverse ? this.pos.from : this.pos.to); + if (this.afterEmptyMatch && this.atOccurrence) { + // do not return the same 0 width match twice + head = Pos(head.line, head.ch) if (reverse) { - if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1) - else if (result.from.line == this.doc.firstLine()) result = null - else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1))) + head.ch--; + if (head.ch < 0) { + head.line--; + head.ch = (this.doc.getLine(head.line) || "").length; + } } else { - if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1) - else if (result.to.line == this.doc.lastLine()) result = null - else result = this.matches(reverse, Pos(result.to.line + 1, 0)) + head.ch++; + if (head.ch > (this.doc.getLine(head.line) || "").length) { + head.ch = 0; + head.line++; + } + } + if (CodeMirror.cmpPos(head, this.doc.clipPos(head)) != 0) { + return this.atOccurrence = false } } + var result = this.matches(reverse, head) + this.afterEmptyMatch = result && CodeMirror.cmpPos(result.from, result.to) == 0 if (result) { this.pos = result diff --git a/docs/snippets/node_modules/codemirror/keymap/emacs.js b/docs/snippets/node_modules/codemirror/keymap/emacs.js index 84744e40..9e7ae60f 100644 --- a/docs/snippets/node_modules/codemirror/keymap/emacs.js +++ b/docs/snippets/node_modules/codemirror/keymap/emacs.js @@ -330,9 +330,9 @@ cmds.previousLine = move(byLine, -1); - cmds.scrollDownCommand = move(byPage, 1); + cmds.scrollDownCommand = move(byPage, -1); - cmds.scrollUpCommand = move(byPage, -1); + cmds.scrollUpCommand = move(byPage, 1); cmds.backwardParagraph = move(byParagraph, -1); @@ -480,8 +480,8 @@ "Home": "goLineStart", "Alt-V": "scrollDownCommand", "Ctrl-V": "scrollUpCommand", - "PageUp": "scrollUpCommand", - "PageDown": "scrollDownCommand", + "PageUp": "scrollDownCommand", + "PageDown": "scrollUpCommand", "Ctrl-Up": "backwardParagraph", "Ctrl-Down": "forwardParagraph", "Alt-{": "backwardParagraph", diff --git a/docs/snippets/node_modules/codemirror/keymap/vim.js b/docs/snippets/node_modules/codemirror/keymap/vim.js index 6630b6f6..b7c88848 100644 --- a/docs/snippets/node_modules/codemirror/keymap/vim.js +++ b/docs/snippets/node_modules/codemirror/keymap/vim.js @@ -44,6 +44,27 @@ })(function(CodeMirror) { 'use strict'; + var Pos = CodeMirror.Pos; + + function transformCursor(cm, range) { + var vim = cm.state.vim; + if (!vim || vim.insertMode) return range.head; + var head = vim.sel.head; + if (!head) return range.head; + + if (vim.visualBlock) { + if (range.head.line != head.line) { + return; + } + } + if (range.from() == range.anchor && !range.empty()) { + if (range.head.line == head.line && range.head.ch != head.ch) + return new Pos(range.head.line, range.head.ch - 1); + } + + return range.head; + } + var defaultKeymap = [ // Key to key mapping. This goes first to make it possible to override // existing mappings. @@ -154,6 +175,7 @@ { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'}, { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'}, { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'}, + { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveToStartOfLine', context: 'insert' }, { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' }, //ignore C-w in normal mode { keys: '', type: 'idle', context: 'normal' }, @@ -248,8 +270,6 @@ { name: 'global', shortName: 'g' } ]; - var Pos = CodeMirror.Pos; - var Vim = function() { function enterVimMode(cm) { cm.setOption('disableInput', true); @@ -265,15 +285,13 @@ cm.off('cursorActivity', onCursorActivity); CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); cm.state.vim = null; + if (highlightTimeout) clearTimeout(highlightTimeout); } function detachVimMap(cm, next) { if (this == CodeMirror.keyMap.vim) { + cm.options.$customCursor = null; CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); - if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) { - disableFatCursorMark(cm); - cm.getInputField().style.caretColor = ""; - } } if (!next || next.attach != attachVimMap) @@ -281,57 +299,15 @@ } function attachVimMap(cm, prev) { if (this == CodeMirror.keyMap.vim) { + if (cm.curOp) cm.curOp.selectionChanged = true; + cm.options.$customCursor = transformCursor; CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); - if (cm.getOption("inputStyle") == "contenteditable" && document.body.style.caretColor != null) { - enableFatCursorMark(cm); - cm.getInputField().style.caretColor = "transparent"; - } } if (!prev || prev.attach != attachVimMap) enterVimMode(cm); } - function updateFatCursorMark(cm) { - if (!cm.state.fatCursorMarks) return; - clearFatCursorMark(cm); - var ranges = cm.listSelections(), result = [] - for (var i = 0; i < ranges.length; i++) { - var range = ranges[i]; - if (range.empty()) { - var lineLength = cm.getLine(range.anchor.line).length; - if (range.anchor.ch < lineLength) { - result.push(cm.markText(range.anchor, Pos(range.anchor.line, range.anchor.ch + 1), - {className: "cm-fat-cursor-mark"})); - } else { - result.push(cm.markText(Pos(range.anchor.line, lineLength - 1), - Pos(range.anchor.line, lineLength), - {className: "cm-fat-cursor-mark"})); - } - } - } - cm.state.fatCursorMarks = result; - } - - function clearFatCursorMark(cm) { - var marks = cm.state.fatCursorMarks; - if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear(); - } - - function enableFatCursorMark(cm) { - cm.state.fatCursorMarks = []; - updateFatCursorMark(cm) - cm.on("cursorActivity", updateFatCursorMark) - } - - function disableFatCursorMark(cm) { - clearFatCursorMark(cm); - cm.off("cursorActivity", updateFatCursorMark); - // explicitly set fatCursorMarks to null because event listener above - // can be invoke after removing it, if off is called from operation - cm.state.fatCursorMarks = null; - } - // Deprecated, simply setting the keymap works again. CodeMirror.defineOption('vimMode', false, function(cm, val, prev) { if (val && cm.getOption("keyMap") != "vim") @@ -347,7 +323,7 @@ if (!vimKey) { return false; } - var cmd = CodeMirror.Vim.findKey(cm, vimKey); + var cmd = vimApi.findKey(cm, vimKey); if (typeof cmd == 'function') { CodeMirror.signal(cm, 'vim-keypress', vimKey); } @@ -420,6 +396,9 @@ var numbers = makeKeyRange(48, 10); var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '_', '/']); + var upperCaseChars; + try { upperCaseChars = new RegExp("^[\\p{Lu}]$", "u"); } + catch (_) { upperCaseChars = /^[A-Z]$/; } function isLine(cm, line) { return line >= cm.firstLine() && line <= cm.lastLine(); @@ -434,7 +413,7 @@ return numberRegex.test(k); } function isUpperCase(k) { - return (/^[A-Z]$/).test(k); + return upperCaseChars.test(k); } function isWhiteSpaceString(k) { return (/^\s*$/).test(k); @@ -658,7 +637,7 @@ this.latestRegister = registerName; if (cm.openDialog) { this.onRecordingDone = cm.openDialog( - '(recording)['+registerName+']', null, {bottom:true}); + document.createTextNode('(recording)['+registerName+']'), null, {bottom:true}); } this.isRecording = true; } @@ -688,8 +667,6 @@ // executed in between. lastMotion: null, marks: {}, - // Mark for rendering fake cursor for visual mode. - fakeCursor: null, insertMode: false, // Repeat count for changes made in insert mode, triggered by key // sequences like 3,i. Only exists when insertMode is true. @@ -761,7 +738,7 @@ exCommandDispatcher.map(lhs, rhs, ctx); }, unmap: function(lhs, ctx) { - exCommandDispatcher.unmap(lhs, ctx); + return exCommandDispatcher.unmap(lhs, ctx); }, // Non-recursive map function. // NOTE: This will not create mappings to key maps that aren't present @@ -901,7 +878,7 @@ match = (/<\w+-.+?>|<\w+>|./).exec(keys); key = match[0]; keys = keys.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'mapping'); + vimApi.handleKey(cm, key, 'mapping'); } } @@ -948,7 +925,12 @@ if (!keysMatcher) { clearInputState(cm); return false; } var context = vim.visualMode ? 'visual' : 'normal'; - var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); + var mainKey = keysMatcher[2] || keysMatcher[1]; + if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) { + // multikey operators act linewise by repeating only the last character + mainKey = vim.inputState.operatorShortcut; + } + var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context); if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { return true; } @@ -984,7 +966,7 @@ // clear VIM state in case it's in a bad state. cm.state.vim = undefined; maybeInitVimState(cm); - if (!CodeMirror.Vim.suppressErrorLogging) { + if (!vimApi.suppressErrorLogging) { console['log'](e); } throw e; @@ -1308,6 +1290,9 @@ } inputState.operator = command.operator; inputState.operatorArgs = copyArgs(command.operatorArgs); + if (command.keys.length > 1) { + inputState.operatorShortcut = command.keys; + } if (command.exitVisualBlock) { vim.visualBlock = false; updateCmSelection(cm); @@ -1636,17 +1621,17 @@ var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); if (lastSel.visualLine) { // Linewise Visual mode: The same number of lines. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } else if (lastSel.visualBlock) { // Blockwise Visual mode: The same number of lines and columns. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); } else if (lastSel.head.line == lastSel.anchor.line) { // Normal Visual mode within one line: The same number of characters. - newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); + newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset); } else { // Normal Visual mode with several lines: The same number of lines, in the // last line the same number of characters as in the last line the last time. - newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); + newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } vim.visualMode = true; vim.visualLine = lastSel.visualLine; @@ -1686,7 +1671,7 @@ ranges[i].head.ch = lineLength(cm, ranges[i].head.line); } } else if (mode == 'line') { - ranges[0].head = Pos(ranges[0].head.line + 1, 0); + ranges[0].head = new Pos(ranges[0].head.line + 1, 0); } } } else { @@ -1748,22 +1733,22 @@ var motions = { moveToTopLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToMiddleLine: function(cm) { var range = getUserVisibleLines(cm); var line = Math.floor((range.top + range.bottom) * 0.5); - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToBottomLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; - return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); + return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, expandToLine: function(_cm, head, motionArgs) { // Expands forward to end of line, and then to next line if repeat is // >1. Does not handle backward motion! var cur = head; - return Pos(cur.line + motionArgs.repeat - 1, Infinity); + return new Pos(cur.line + motionArgs.repeat - 1, Infinity); }, findNext: function(cm, _head, motionArgs) { var state = getSearchState(cm); @@ -1820,7 +1805,7 @@ // For whatever reason, when we use the "to" as returned by searchcursor.js directly, // the resulting selection is extended by 1 char. Let's shrink it so that only the // match is selected. - var to = Pos(next[1].line, next[1].ch - 1); + var to = new Pos(next[1].line, next[1].ch - 1); if (vim.visualMode) { // If we were in visualLine or visualBlock mode, get out of it. @@ -1869,8 +1854,8 @@ if (vim.visualBlock && motionArgs.sameLine) { var sel = vim.sel; return [ - clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), - clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) + clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)), + clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch)) ]; } else { return ([vim.sel.head, vim.sel.anchor]); @@ -1910,7 +1895,7 @@ // Vim places the cursor on the first non-whitespace character of // the line if there is one, else it places the cursor at the end // of the line, regardless of whether a mark was found. - best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); + best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); } return best; }, @@ -1918,7 +1903,7 @@ var cur = head; var repeat = motionArgs.repeat; var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; - return Pos(cur.line, ch); + return new Pos(cur.line, ch); }, moveByLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -1960,8 +1945,8 @@ endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); vim.lastHPos = endCh; } - vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; - return Pos(line, endCh); + vim.lastHSPos = cm.charCoords(new Pos(line, endCh),'div').left; + return new Pos(line, endCh); }, moveByDisplayLines: function(cm, head, motionArgs, vim) { var cur = head; @@ -1983,7 +1968,7 @@ var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; var res = cm.coordsChar(goalCoords, 'div'); } else { - var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); + var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div'); resCoords.left = vim.lastHSPos; res = cm.coordsChar(resCoords, 'div'); } @@ -2063,7 +2048,7 @@ // Go to the start of the line where the text begins, or the end for // whitespace-only lines var cursor = head; - return Pos(cursor.line, + return new Pos(cursor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); }, moveToMatchedSymbol: function(cm, head) { @@ -2075,7 +2060,7 @@ for (; ch < lineText.length; ch++) { symbol = lineText.charAt(ch); if (symbol && isMatchableSymbol(symbol)) { - var style = cm.getTokenTypeAt(Pos(line, ch + 1)); + var style = cm.getTokenTypeAt(new Pos(line, ch + 1)); if (style !== "string" && style !== "comment") { break; } @@ -2084,21 +2069,21 @@ if (ch < lineText.length) { // Only include angle brackets in analysis if they are being matched. var re = (ch === '<' || ch === '>') ? /[(){}[\]<>]/ : /[(){}[\]]/; - var matched = cm.findMatchingBracket(Pos(line, ch), {bracketRegex: re}); + var matched = cm.findMatchingBracket(new Pos(line, ch), {bracketRegex: re}); return matched.to; } else { return cursor; } }, moveToStartOfLine: function(_cm, head) { - return Pos(head.line, 0); + return new Pos(head.line, 0); }, moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); if (motionArgs.repeatIsExplicit) { lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); } - return Pos(lineNum, + return new Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); }, textObjectManipulation: function(cm, head, motionArgs, vim) { @@ -2261,7 +2246,7 @@ if (anchor.line == cm.firstLine()) { anchor.ch = 0; } else { - anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); + anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); } } text = cm.getRange(anchor, head); @@ -2274,7 +2259,7 @@ text = cm.getSelection(); var replacement = fillArray('', ranges.length); cm.replaceSelections(replacement); - finalHead = ranges[0].anchor; + finalHead = cursorMin(ranges[0].head, ranges[0].anchor); } vimGlobalState.registerController.pushText( args.registerName, 'delete', text, @@ -2408,7 +2393,7 @@ }, scrollToCursor: function(cm, actionArgs) { var lineNum = cm.getCursor().line; - var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); + var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local'); var height = cm.getScrollInfo().clientHeight; var y = charCoords.top; var lineHeight = charCoords.bottom - y; @@ -2460,9 +2445,9 @@ var head = actionArgs.head || cm.getCursor('head'); var height = cm.listSelections().length; if (insertAt == 'eol') { - head = Pos(head.line, lineLength(cm, head.line)); + head = new Pos(head.line, lineLength(cm, head.line)); } else if (insertAt == 'bol') { - head = Pos(head.line, 0); + head = new Pos(head.line, 0); } else if (insertAt == 'charAfter') { head = offsetCursor(head, 0, 1); } else if (insertAt == 'firstNonBlank') { @@ -2474,10 +2459,10 @@ if (sel.head.line < sel.anchor.line) { head = sel.head; } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.ch, sel.anchor.ch)); height = Math.abs(sel.head.line - sel.anchor.line) + 1; @@ -2489,12 +2474,12 @@ if (sel.head.line >= sel.anchor.line) { head = offsetCursor(sel.head, 0, 1); } else { - head = Pos(sel.anchor.line, 0); + head = new Pos(sel.anchor.line, 0); } } else { - head = Pos( + head = new Pos( Math.min(sel.head.line, sel.anchor.line), - Math.max(sel.head.ch + 1, sel.anchor.ch)); + Math.max(sel.head.ch, sel.anchor.ch) + 1); height = Math.abs(sel.head.line - sel.anchor.line) + 1; } } else if (insertAt == 'inplace') { @@ -2538,7 +2523,7 @@ vim.visualLine = !!actionArgs.linewise; vim.visualBlock = !!actionArgs.blockwise; head = clipCursorToContent( - cm, Pos(anchor.line, anchor.ch + repeat - 1)); + cm, new Pos(anchor.line, anchor.ch + repeat - 1)); vim.sel = { anchor: anchor, head: head @@ -2601,13 +2586,13 @@ // Repeat is the number of lines to join. Minimum 2 lines. var repeat = Math.max(actionArgs.repeat, 2); curStart = cm.getCursor(); - curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, + curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1, Infinity)); } var finalCh = 0; for (var i = curStart.line; i < curEnd.line; i++) { finalCh = lineLength(cm, curStart.line); - var tmp = Pos(curStart.line + 1, + var tmp = new Pos(curStart.line + 1, lineLength(cm, curStart.line + 1)); var text = cm.getRange(curStart, tmp); text = actionArgs.keepSpaces @@ -2615,7 +2600,7 @@ : text.replace(/\n\s*/g, ' '); cm.replaceRange(text, curStart, tmp); } - var curFinalPos = Pos(curStart.line, finalCh); + var curFinalPos = new Pos(curStart.line, finalCh); if (vim.visualMode) { exitVisualMode(cm, false); } @@ -2626,7 +2611,7 @@ var insertAt = copyCursor(cm.getCursor()); if (insertAt.line === cm.firstLine() && !actionArgs.after) { // Special case for inserting newline before start of document. - cm.replaceRange('\n', Pos(cm.firstLine(), 0)); + cm.replaceRange('\n', new Pos(cm.firstLine(), 0)); cm.setCursor(cm.firstLine(), 0); } else { insertAt.line = (actionArgs.after) ? insertAt.line : @@ -2727,7 +2712,7 @@ // first delete the selected text cm.replaceSelections(emptyStrings); // Set new selections as per the block length of the yanked text - selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); + selectionEnd = new Pos(selectionStart.line + text.length-1, selectionStart.ch); cm.setCursor(selectionStart); selectBlock(cm, selectionEnd); cm.replaceSelections(text); @@ -2754,7 +2739,7 @@ for (var i = 0; i < text.length; i++) { var line = cur.line+i; if (line > cm.lastLine()) { - cm.replaceRange('\n', Pos(line, 0)); + cm.replaceRange('\n', new Pos(line, 0)); } var lastCh = lineLength(cm, line); if (lastCh < cur.ch) { @@ -2762,18 +2747,18 @@ } } cm.setCursor(cur); - selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); + selectBlock(cm, new Pos(cur.line + text.length-1, cur.ch)); cm.replaceSelections(text); curPosFinal = cur; } else { cm.replaceRange(text, cur); // Now fine tune the cursor to where we want it. if (linewise && actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line + 1, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); } else if (linewise && !actionArgs.after) { - curPosFinal = Pos( + curPosFinal = new Pos( cur.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); } else if (!linewise && actionArgs.after) { @@ -2821,7 +2806,7 @@ if (replaceTo > line.length) { replaceTo=line.length; } - curEnd = Pos(curStart.line, replaceTo); + curEnd = new Pos(curStart.line, replaceTo); } if (replaceWith=='\n') { if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); @@ -2877,13 +2862,13 @@ } else { numberStr = baseStr + zeroPadding + numberStr; } - var from = Pos(cur.line, start); - var to = Pos(cur.line, end); + var from = new Pos(cur.line, start); + var to = new Pos(cur.line, end); cm.replaceRange(numberStr, from, to); } else { return; } - cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); + cm.setCursor(new Pos(cur.line, start + numberStr.length - 1)); }, repeatLastEdit: function(cm, actionArgs, vim) { var lastEditInputState = vim.lastEditInputState; @@ -2920,7 +2905,7 @@ var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak; var ch = Math.min(Math.max(0, cur.ch), maxCh); - return Pos(line, ch); + return new Pos(line, ch); } function copyArgs(args) { var ret = {}; @@ -2936,7 +2921,7 @@ offsetCh = offsetLine.ch; offsetLine = offsetLine.line; } - return Pos(cur.line + offsetLine, cur.ch + offsetCh); + return new Pos(cur.line + offsetLine, cur.ch + offsetCh); } function commandMatches(keys, keyMap, context, inputState) { // Partial matches are not applied. They inform the key handler @@ -2996,7 +2981,7 @@ }; } function copyCursor(cur) { - return Pos(cur.line, cur.ch); + return new Pos(cur.line, cur.ch); } function cursorEqual(cur1, cur2) { return cur1.ch == cur2.ch && cur1.line == cur2.line; @@ -3043,7 +3028,7 @@ function extendLineToColumn(cm, lineNum, column) { var endCh = lineLength(cm, lineNum); var spaces = new Array(column-endCh+1).join(' '); - cm.setCursor(Pos(lineNum, endCh)); + cm.setCursor(new Pos(lineNum, endCh)); cm.replaceRange(spaces, cm.getCursor()); } // This functions selects a rectangular block @@ -3124,13 +3109,13 @@ if (block) { var width = block.width; var height = block.height; - selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); + selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width); var selections = []; // selectBlock creates a 'proper' rectangular block. // We do not want that in all cases, so we manually set selections. for (var i = selectionStart.line; i < selectionEnd.line; i++) { - var anchor = Pos(i, selectionStart.ch); - var head = Pos(i, selectionEnd.ch); + var anchor = new Pos(i, selectionStart.ch); + var head = new Pos(i, selectionEnd.ch); var range = {anchor: anchor, head: head}; selections.push(range); } @@ -3142,8 +3127,8 @@ var ch = end.ch - start.ch; selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; if (lastSelection.visualLine) { - selectionStart = Pos(selectionStart.line, 0); - selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); + selectionStart = new Pos(selectionStart.line, 0); + selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); } cm.setSelection(selectionStart, selectionEnd); } @@ -3192,7 +3177,7 @@ head = cursorMax(head, end); head = offsetCursor(head, 0, -1); if (head.ch == -1 && head.line != cm.firstLine()) { - head = Pos(head.line - 1, lineLength(cm, head.line - 1)); + head = new Pos(head.line - 1, lineLength(cm, head.line - 1)); } } return [anchor, head]; @@ -3208,7 +3193,6 @@ vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; var cmSel = makeCmSelection(cm, sel, mode); cm.setSelections(cmSel.ranges, cmSel.primary); - updateFakeCursor(cm); } function makeCmSelection(cm, sel, mode, exclusive) { var head = copyCursor(sel.head); @@ -3241,16 +3225,18 @@ }; } else if (mode == 'block') { var top = Math.min(anchor.line, head.line), - left = Math.min(anchor.ch, head.ch), + fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), - right = Math.max(anchor.ch, head.ch) + 1; + toCh = head.ch; + if (fromCh < toCh) { toCh += 1 } + else { fromCh += 1 }; var height = bottom - top + 1; var primary = head.line == top ? 0 : height - 1; var ranges = []; for (var i = 0; i < height; i++) { ranges.push({ - anchor: Pos(top + i, left), - head: Pos(top + i, right) + anchor: new Pos(top + i, fromCh), + head: new Pos(top + i, toCh) }); } return { @@ -3284,7 +3270,6 @@ vim.visualLine = false; vim.visualBlock = false; if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); - clearFakeCursor(vim); } // Remove any trailing newlines from the selection. For @@ -3372,7 +3357,7 @@ if (!start) { start = wordStart; } } } - return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; + return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) }; } /** @@ -3546,7 +3531,7 @@ } } if (state.nextCh || state.curMoveThrough) { - return Pos(line, state.index); + return new Pos(line, state.index); } return cur; } @@ -3658,7 +3643,7 @@ break; } words.push(word); - cur = Pos(word.line, forward ? (word.to - 1) : word.from); + cur = new Pos(word.line, forward ? (word.to - 1) : word.from); } var shortCircuit = words.length != repeat; var firstWord = words[0]; @@ -3669,25 +3654,25 @@ // We did not start in the middle of a word. Discard the extra word at the end. lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } else if (forward && wordEnd) { - return Pos(lastWord.line, lastWord.to - 1); + return new Pos(lastWord.line, lastWord.to - 1); } else if (!forward && wordEnd) { // ge if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { // We did not start in the middle of a word. Discard the extra word at the end. lastWord = words.pop(); } - return Pos(lastWord.line, lastWord.to); + return new Pos(lastWord.line, lastWord.to); } else { // b - return Pos(lastWord.line, lastWord.from); + return new Pos(lastWord.line, lastWord.from); } } function moveToEol(cm, head, motionArgs, vim, keepHPos) { var cur = head; - var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); + var retval= new Pos(cur.line + motionArgs.repeat - 1, Infinity); var end=cm.clipPos(retval); end.ch--; if (!keepHPos) { @@ -3709,14 +3694,14 @@ } start = idx; } - return Pos(cm.getCursor().line, idx); + return new Pos(cm.getCursor().line, idx); } function moveToColumn(cm, repeat) { // repeat is always >= 1, so repeat - 1 always corresponds // to the column we want to go to. var line = cm.getCursor().line; - return clipCursorToContent(cm, Pos(line, repeat - 1)); + return clipCursorToContent(cm, new Pos(line, repeat - 1)); } function updateMark(cm, vim, markName, pos) { @@ -3968,7 +3953,7 @@ repeat--; } - return Pos(curr_index.ln, curr_index.pos); + return new Pos(curr_index.ln, curr_index.pos); } // TODO: perhaps this finagling of start and end positions belongs @@ -3991,8 +3976,8 @@ // cursor is on a matching open bracket. var offset = curChar === openSym ? 1 : 0; - start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); - end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); + start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp}); + end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp}); if (!start || !end) { return { start: cur, end: cur }; @@ -4073,8 +4058,8 @@ } return { - start: Pos(cur.line, start), - end: Pos(cur.line, end) + start: new Pos(cur.line, start), + end: new Pos(cur.line, end) }; } @@ -4294,7 +4279,7 @@ ignoreCase = (/^[^A-Z]*$/).test(regexPart); } var regexp = new RegExp(regexPart, - (ignoreCase || forceIgnoreCase) ? 'i' : undefined); + (ignoreCase || forceIgnoreCase) ? 'im' : 'm'); return regexp; } @@ -4324,7 +4309,7 @@ } function showConfirm(cm, template) { - var pre = dom('pre', {$color: 'red'}, template); + var pre = dom('pre', {$color: 'red', class: 'cm-vim-message'}, template); if (cm.openNotification) { cm.openNotification(pre, {bottom: true, duration: 5000}); } else { @@ -4342,7 +4327,6 @@ } function showPrompt(cm, options) { - var shortText = (options.prefix || '') + ' ' + (options.desc || ''); var template = makePrompt(options.prefix, options.desc); if (cm.openDialog) { cm.openDialog(template, options.onClose, { @@ -4351,6 +4335,9 @@ }); } else { + var shortText = ''; + if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent; + if (options.desc) shortText += " " + options.desc; options.onClose(prompt(shortText, '')); } } @@ -4425,6 +4412,7 @@ function highlightSearchMatches(cm, query) { clearTimeout(highlightTimeout); highlightTimeout = setTimeout(function() { + if (!cm.state.vim) return; var searchState = getSearchState(cm); var overlay = searchState.getOverlay(); if (!overlay || query != overlay.query) { @@ -4450,12 +4438,19 @@ var cursor = cm.getSearchCursor(query, pos); for (var i = 0; i < repeat; i++) { var found = cursor.find(prev); - if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } + if (i == 0 && found && cursorEqual(cursor.from(), pos)) { + var lastEndPos = prev ? cursor.from() : cursor.to(); + found = cursor.find(prev); + if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) { + if (cm.getLine(lastEndPos.line).length == lastEndPos.ch) + found = cursor.find(prev); + } + } if (!found) { // SearchCursor may have returned null because it hit EOF, wrap // around and try again. cursor = cm.getSearchCursor(query, - (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } @@ -4491,7 +4486,7 @@ // SearchCursor may have returned null because it hit EOF, wrap // around and try again. cursor = cm.getSearchCursor(query, - (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); + (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } @@ -4547,7 +4542,7 @@ function getMarkPos(cm, vim, markName) { if (markName == '\'' || markName == '`') { - return vimGlobalState.jumpList.find(cm, -1) || Pos(0, 0); + return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0); } else if (markName == '.') { return getLastEditPos(cm); } @@ -4612,7 +4607,7 @@ if (command.type == 'exToKey') { // Handle Ex to Key mapping. for (var i = 0; i < command.toKeys.length; i++) { - CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); + vimApi.handleKey(cm, command.toKeys[i], 'mapping'); } return; } else if (command.type == 'exToEx') { @@ -4787,7 +4782,7 @@ var commandName = lhs.substring(1); if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { delete this.commandMap_[commandName]; - return; + return true; } } else { // Key to Ex or key to key mapping @@ -4796,11 +4791,10 @@ if (keys == defaultKeymap[i].keys && defaultKeymap[i].context === ctx) { defaultKeymap.splice(i, 1); - return; + return true; } } } - throw Error('No such mapping.'); } }; @@ -4827,13 +4821,11 @@ vmap: function(cm, params) { this.map(cm, params, 'visual'); }, unmap: function(cm, params, ctx) { var mapArgs = params.args; - if (!mapArgs || mapArgs.length < 1) { + if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) { if (cm) { showConfirm(cm, 'No such mapping: ' + params.input); } - return; } - exCommandDispatcher.unmap(mapArgs[0], ctx); }, move: function(cm, params) { commandDispatcher.processCommand(cm, cm.state.vim, { @@ -4961,8 +4953,8 @@ var lineStart = params.line || cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); if (lineStart == lineEnd) { return; } - var curStart = Pos(lineStart, 0); - var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); + var curStart = new Pos(lineStart, 0); + var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd)); var text = cm.getRange(curStart, curEnd).split('\n'); var numberRegex = pattern ? pattern : (number == 'decimal') ? /(-?)([\d]+)/ : @@ -5103,12 +5095,6 @@ regexPart = new RegExp(regexPart).source; //normalize not escaped characters } replacePart = tokens[1]; - // If the pattern ends with $ (line boundary assertion), change $ to \n. - // Caveat: this workaround cannot match on the last line of the document. - if (/(^|[^\\])(\\\\)*\$$/.test(regexPart)) { - regexPart = regexPart.slice(0, -1) + '\\n'; - replacePart = (replacePart || '') + '\n'; - } if (replacePart !== undefined) { if (getOption('pcre')) { replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&")); @@ -5174,7 +5160,7 @@ lineStart = lineEnd; lineEnd = lineStart + count - 1; } - var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); + var startPos = clipCursorToContent(cm, new Pos(lineStart, 0)); var cursor = cm.getSearchCursor(query, startPos); doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); }, @@ -5298,10 +5284,18 @@ lineEnd += modifiedLineNumber - unmodifiedLineNumber; joined = modifiedLineNumber < unmodifiedLineNumber; } + function findNextValidMatch() { + var lastMatchTo = lastPos && copyCursor(searchCursor.to()); + var match = searchCursor.findNext(); + if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) { + match = searchCursor.findNext(); + } + return match; + } function next() { // The below only loops to skip over multiple occurrences on the same // line when 'global' is not true. - while(searchCursor.findNext() && + while(findNextValidMatch() && isInRange(searchCursor.from(), lineStart, lineEnd)) { if (!global && searchCursor.from().line == modifiedLineNumber && !joined) { continue; @@ -5466,7 +5460,7 @@ match = (/<\w+-.+?>|<\w+>|./).exec(text); key = match[0]; text = text.substring(match.index + key.length); - CodeMirror.Vim.handleKey(cm, key, 'macro'); + vimApi.handleKey(cm, key, 'macro'); if (vim.insertMode) { var changes = register.insertModeChanges[imc++].changes; vimGlobalState.macroModeState.lastInsertModeChanges.changes = @@ -5561,36 +5555,6 @@ } else if (!cm.curOp.isVimOp) { handleExternalSelection(cm, vim); } - if (vim.visualMode) { - updateFakeCursor(cm); - } - } - /** - * Keeps track of a fake cursor to support visual mode cursor behavior. - */ - function updateFakeCursor(cm) { - var className = 'cm-animate-fat-cursor'; - var vim = cm.state.vim; - var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); - var to = offsetCursor(from, 0, 1); - clearFakeCursor(vim); - // In visual mode, the cursor may be positioned over EOL. - if (from.ch == cm.getLine(from.line).length) { - var widget = dom('span', { 'class': className }, '\u00a0'); - vim.fakeCursorBookmark = cm.setBookmark(from, {widget: widget}); - } else { - vim.fakeCursor = cm.markText(from, to, {className: className}); - } - } - function clearFakeCursor(vim) { - if (vim.fakeCursor) { - vim.fakeCursor.clear(); - vim.fakeCursor = null; - } - if (vim.fakeCursorBookmark) { - vim.fakeCursorBookmark.clear(); - vim.fakeCursorBookmark = null; - } } function handleExternalSelection(cm, vim) { var anchor = cm.getCursor('anchor'); @@ -5732,12 +5696,12 @@ if (change instanceof InsertModeKey) { CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); } else if (typeof change == "string") { - var cur = cm.getCursor(); - cm.replaceRange(change, cur, cur); + cm.replaceSelection(change); } else { var start = cm.getCursor(); var end = offsetCursor(start, 0, change[0].length); cm.replaceRange(change[0], start, end); + cm.setCursor(end); } } } diff --git a/docs/snippets/node_modules/codemirror/lib/codemirror.css b/docs/snippets/node_modules/codemirror/lib/codemirror.css index a64f97c7..d85fbc93 100644 --- a/docs/snippets/node_modules/codemirror/lib/codemirror.css +++ b/docs/snippets/node_modules/codemirror/lib/codemirror.css @@ -60,20 +60,13 @@ .cm-fat-cursor div.CodeMirror-cursors { z-index: 1; } -.cm-fat-cursor-mark { - background-color: rgba(20, 255, 20, 0.5); - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; -} -.cm-animate-fat-cursor { - width: auto; - border: 0; - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; - background-color: #7e7; -} +.cm-fat-cursor .CodeMirror-line::selection, +.cm-fat-cursor .CodeMirror-line > span::selection, +.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; } +.cm-fat-cursor .CodeMirror-line::-moz-selection, +.cm-fat-cursor .CodeMirror-line > span::-moz-selection, +.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; } +.cm-fat-cursor { caret-color: transparent; } @-moz-keyframes blink { 0% {} 50% { background-color: transparent; } diff --git a/docs/snippets/node_modules/codemirror/lib/codemirror.js b/docs/snippets/node_modules/codemirror/lib/codemirror.js index 42c068c2..b9675f4b 100644 --- a/docs/snippets/node_modules/codemirror/lib/codemirror.js +++ b/docs/snippets/node_modules/codemirror/lib/codemirror.js @@ -2351,12 +2351,14 @@ function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) { return {map: lineView.measure.map, cache: lineView.measure.cache} } - for (var i = 0; i < lineView.rest.length; i++) - { if (lineView.rest[i] == line) - { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } - for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) - { if (lineNo(lineView.rest[i$1]) > lineN) - { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } + if (lineView.rest) { + for (var i = 0; i < lineView.rest.length; i++) + { if (lineView.rest[i] == line) + { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } + for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) + { if (lineNo(lineView.rest[i$1]) > lineN) + { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } + } } // Render a line into the hidden node display.externalMeasured. Used @@ -3150,13 +3152,19 @@ var curFragment = result.cursors = document.createDocumentFragment(); var selFragment = result.selection = document.createDocumentFragment(); + var customCursor = cm.options.$customCursor; + if (customCursor) { primary = true; } for (var i = 0; i < doc.sel.ranges.length; i++) { if (!primary && i == doc.sel.primIndex) { continue } var range = doc.sel.ranges[i]; if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } var collapsed = range.empty(); - if (collapsed || cm.options.showCursorWhenSelecting) - { drawSelectionCursor(cm, range.head, curFragment); } + if (customCursor) { + var head = customCursor(cm, range); + if (head) { drawSelectionCursor(cm, head, curFragment); } + } else if (collapsed || cm.options.showCursorWhenSelecting) { + drawSelectionCursor(cm, range.head, curFragment); + } if (!collapsed) { drawSelectionRange(cm, range, selFragment); } } @@ -3172,6 +3180,12 @@ cursor.style.top = pos.top + "px"; cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; + if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) { + var charPos = charCoords(cm, head, "div", null, null); + var width = charPos.right - charPos.left; + cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px"; + } + if (pos.other) { // Secondary cursor, shown when on a 'jump' in bi-directional text var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); @@ -3344,10 +3358,14 @@ function updateHeightsInViewport(cm) { var display = cm.display; var prevBottom = display.lineDiv.offsetTop; + var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top); + var oldHeight = display.lineDiv.getBoundingClientRect().top; + var mustScroll = 0; for (var i = 0; i < display.view.length; i++) { var cur = display.view[i], wrapping = cm.options.lineWrapping; var height = (void 0), width = 0; if (cur.hidden) { continue } + oldHeight += cur.line.height; if (ie && ie_version < 8) { var bot = cur.node.offsetTop + cur.node.offsetHeight; height = bot - prevBottom; @@ -3362,6 +3380,7 @@ } var diff = cur.line.height - height; if (diff > .005 || diff < -.005) { + if (oldHeight < viewTop) { mustScroll -= diff; } updateLineHeight(cur.line, height); updateWidgetHeight(cur.line); if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) @@ -3376,6 +3395,7 @@ } } } + if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; } } // Read and store the height of line widgets associated with the @@ -3636,6 +3656,7 @@ this.vert.firstChild.style.height = Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; } else { + this.vert.scrollTop = 0; this.vert.style.display = ""; this.vert.firstChild.style.height = "0"; } @@ -4386,6 +4407,10 @@ // The element in which the editor lives. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); + // This attribute is respected by automatic translation systems such as Google Translate, + // and may also be respected by tools used by human translators. + d.wrapper.setAttribute('translate', 'no'); + // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; } @@ -4483,6 +4508,12 @@ function onScrollWheel(cm, e) { var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; + var pixelsPerUnit = wheelPixelsPerUnit; + if (e.deltaMode === 0) { + dx = e.deltaX; + dy = e.deltaY; + pixelsPerUnit = 1; + } var display = cm.display, scroll = display.scroller; // Quit if there's nothing to scroll here @@ -4511,10 +4542,10 @@ // estimated pixels/delta value, we just handle horizontal // scrolling entirely here. It'll be slightly off from native, but // better than glitching out. - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { + if (dx && !gecko && !presto && pixelsPerUnit != null) { if (dy && canScrollY) - { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); } - setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)); + { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); } + setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit)); // Only prevent default scrolling if vertical scrolling is // actually possible. Otherwise, it causes vertical scroll // jitter on OSX trackpads when deltaX is small and deltaY @@ -4527,15 +4558,15 @@ // 'Project' the visible viewport to cover the area that is being // scrolled into view (if we know enough to estimate it). - if (dy && wheelPixelsPerUnit != null) { - var pixels = dy * wheelPixelsPerUnit; + if (dy && pixelsPerUnit != null) { + var pixels = dy * pixelsPerUnit; var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; if (pixels < 0) { top = Math.max(0, top + pixels - 50); } else { bot = Math.min(cm.doc.height, bot + pixels + 50); } updateDisplaySimple(cm, {top: top, bottom: bot}); } - if (wheelSamples < 20) { + if (wheelSamples < 20 && e.deltaMode !== 0) { if (display.wheelStartX == null) { display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; display.wheelDX = dx; display.wheelDY = dy; @@ -6143,6 +6174,7 @@ getRange: function(from, to, lineSep) { var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); if (lineSep === false) { return lines } + if (lineSep === '') { return lines.join('') } return lines.join(lineSep || this.lineSeparator()) }, @@ -8211,7 +8243,7 @@ } function hiddenTextarea() { - var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"); + var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"); var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); // The textarea is kept positioned near the cursor to prevent the // fact that it'll be scrolled into view on input from scrolling @@ -8975,9 +9007,11 @@ ContentEditableInput.prototype.supportsTouch = function () { return true }; ContentEditableInput.prototype.receivedFocus = function () { + var this$1 = this; + var input = this; if (this.selectionInEditor()) - { this.pollSelection(); } + { setTimeout(function () { return this$1.pollSelection(); }, 20); } else { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } @@ -9806,7 +9840,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.61.1"; + CodeMirror.version = "5.64.0"; return CodeMirror; diff --git a/docs/snippets/node_modules/codemirror/mode/clike/clike.js b/docs/snippets/node_modules/codemirror/mode/clike/clike.js index 15c0fd11..916aee61 100644 --- a/docs/snippets/node_modules/codemirror/mode/clike/clike.js +++ b/docs/snippets/node_modules/codemirror/mode/clike/clike.js @@ -484,7 +484,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "instanceof interface native new package private protected public " + "return static strictfp super switch synchronized this throw throws transient " + "try volatile while @interface"), - types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " + + types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float " + "Integer Long Number Object Short String StringBuffer StringBuilder Void"), blockKeywords: words("catch class do else finally for if switch try while"), defKeywords: words("class interface enum @interface"), diff --git a/docs/snippets/node_modules/codemirror/mode/cobol/cobol.js b/docs/snippets/node_modules/codemirror/mode/cobol/cobol.js index 275857b4..a7aeafa0 100644 --- a/docs/snippets/node_modules/codemirror/mode/cobol/cobol.js +++ b/docs/snippets/node_modules/codemirror/mode/cobol/cobol.js @@ -195,7 +195,7 @@ CodeMirror.defineMode("cobol", function () { case "string": // multi-line string parsing mode var next = false; while ((next = stream.next()) != null) { - if (next == "\"" || next == "\'") { + if ((next == "\"" || next == "\'") && !stream.match(/['"]/, false)) { state.mode = false; break; } diff --git a/docs/snippets/node_modules/codemirror/mode/css/css.js b/docs/snippets/node_modules/codemirror/mode/css/css.js index 88a869bf..880b58ef 100644 --- a/docs/snippets/node_modules/codemirror/mode/css/css.js +++ b/docs/snippets/node_modules/codemirror/mode/css/css.js @@ -443,13 +443,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "monochrome", "min-monochrome", "max-monochrome", "resolution", "min-resolution", "max-resolution", "scan", "grid", "orientation", "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", - "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme" + "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme", + "dynamic-range", "video-dynamic-range" ], mediaFeatures = keySet(mediaFeatures_); var mediaValueKeywords_ = [ "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", "interlace", "progressive", - "dark", "light" + "dark", "light", + "standard", "high" ], mediaValueKeywords = keySet(mediaValueKeywords_); var propertyKeywords_ = [ @@ -482,7 +484,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "cue-before", "cursor", "direction", "display", "dominant-baseline", "drop-initial-after-adjust", "drop-initial-after-align", "drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size", - "drop-initial-value", "elevation", "empty-cells", "fit", "fit-position", + "drop-initial-value", "elevation", "empty-cells", "fit", "fit-content", "fit-position", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into", "font", "font-family", "font-feature-settings", "font-kerning", @@ -564,7 +566,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { ], propertyKeywords = keySet(propertyKeywords_); var nonStandardPropertyKeywords_ = [ - "border-block", "border-block-color", "border-block-end", + "accent-color", "aspect-ratio", "border-block", "border-block-color", "border-block-end", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-start", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-block-style", "border-block-width", @@ -572,9 +574,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", - "border-inline-style", "border-inline-width", "margin-block", + "border-inline-style", "border-inline-width", "content-visibility", "margin-block", "margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end", - "margin-inline-start", "padding-block", "padding-block-end", + "margin-inline-start", "overflow-anchor", "overscroll-behavior", "padding-block", "padding-block-end", "padding-block-start", "padding-inline", "padding-inline-end", "padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color", "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", @@ -598,16 +600,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", - "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", + "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", - "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", - "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", + "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", + "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", - "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", - "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", + "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", + "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", @@ -617,7 +619,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", - "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", + "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen" ], colorKeywords = keySet(colorKeywords_); @@ -628,21 +630,21 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary", - "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", - "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", + "bengali", "blink", "block", "block-axis", "blur", "bold", "bolder", "border", "border-box", + "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "compact", "condensed", "contain", "content", "contents", - "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", - "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", + "content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop", + "cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "difference", "disc", "discard", "disclosure-closed", "disclosure-open", "document", "dot-dash", "dot-dot-dash", - "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", + "dotted", "double", "down", "drop-shadow", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", @@ -652,10 +654,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", - "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove", + "forwards", "from", "geometricPrecision", "georgian", "grayscale", "graytext", "grid", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew", "help", "hidden", "hide", "higher", "highlight", "highlighttext", - "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", + "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "hue-rotate", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", @@ -689,11 +691,11 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", - "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", + "s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end", - "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", + "semi-condensed", "semi-expanded", "separate", "sepia", "serif", "show", "sidama", "simp-chinese-formal", "simp-chinese-informal", "single", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", diff --git a/docs/snippets/node_modules/codemirror/mode/gas/gas.js b/docs/snippets/node_modules/codemirror/mode/gas/gas.js index b3515abe..016dc29d 100644 --- a/docs/snippets/node_modules/codemirror/mode/gas/gas.js +++ b/docs/snippets/node_modules/codemirror/mode/gas/gas.js @@ -144,18 +144,26 @@ CodeMirror.defineMode("gas", function(_config, parserConfig) { function x86(_parserConfig) { lineCommentStartSymbol = "#"; + registers.al = "variable"; + registers.ah = "variable"; registers.ax = "variable"; registers.eax = "variable-2"; registers.rax = "variable-3"; + registers.bl = "variable"; + registers.bh = "variable"; registers.bx = "variable"; registers.ebx = "variable-2"; registers.rbx = "variable-3"; + registers.cl = "variable"; + registers.ch = "variable"; registers.cx = "variable"; registers.ecx = "variable-2"; registers.rcx = "variable-3"; + registers.dl = "variable"; + registers.dh = "variable"; registers.dx = "variable"; registers.edx = "variable-2"; registers.rdx = "variable-3"; diff --git a/docs/snippets/node_modules/codemirror/mode/javascript/javascript.js b/docs/snippets/node_modules/codemirror/mode/javascript/javascript.js index 2b508c48..95cbbd85 100644 --- a/docs/snippets/node_modules/codemirror/mode/javascript/javascript.js +++ b/docs/snippets/node_modules/codemirror/mode/javascript/javascript.js @@ -482,7 +482,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function quasi(type, value) { if (type != "quasi") return pass(); if (value.slice(value.length - 2) != "${") return cont(quasi); - return cont(expression, continueQuasi); + return cont(maybeexpression, continueQuasi); } function continueQuasi(type) { if (type == "}") { diff --git a/docs/snippets/node_modules/codemirror/mode/julia/julia.js b/docs/snippets/node_modules/codemirror/mode/julia/julia.js index de9f987d..cb0d69c8 100644 --- a/docs/snippets/node_modules/codemirror/mode/julia/julia.js +++ b/docs/snippets/node_modules/codemirror/mode/julia/julia.js @@ -12,9 +12,10 @@ "use strict"; CodeMirror.defineMode("julia", function(config, parserConf) { - function wordRegexp(words, end) { + function wordRegexp(words, end, pre) { + if (typeof pre === "undefined") { pre = ""; } if (typeof end === "undefined") { end = "\\b"; } - return new RegExp("^((" + words.join(")|(") + "))" + end); + return new RegExp("^" + pre + "((" + words.join(")|(") + "))" + end); } var octChar = "\\\\[0-7]{1,3}"; @@ -22,13 +23,18 @@ CodeMirror.defineMode("julia", function(config, parserConf) { var sChar = "\\\\[abefnrtv0%?'\"\\\\]"; var uChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])"; + var asciiOperatorsList = [ + "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "--?>", "<--[->]?", "\\/\\/", + "\\.{2,3}", "[\\.\\\\%*+\\-<>!\\/^|&]=?", "\\?", "\\$", "~", ":" + ]; var operators = parserConf.operators || wordRegexp([ - "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "->", "\\/\\/", - "[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", - "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", - "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", - "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", - "\\b(in|isa)\\b(?!\.?\\()"], ""); + "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "--?>", "<--[->]?", "\\/\\/", + "[\\\\%*+\\-<>!\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", + "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", + "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", + "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", + "\\b(in|isa)\\b(?!\.?\\()" + ], ""); var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/; @@ -57,10 +63,13 @@ CodeMirror.defineMode("julia", function(config, parserConf) { var keywords = wordRegexp(keywordsList); var builtins = wordRegexp(builtinsList); - var macro = /^@[_A-Za-z][\w]*/; + var macro = /^@[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; var stringPrefixes = /^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/; + var macroOperators = wordRegexp(asciiOperatorsList, "", "@"); + var symbolOperators = wordRegexp(asciiOperatorsList, "", ":"); + function inArray(state) { return (state.nestedArrays > 0); } @@ -165,8 +174,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { } // Handle symbols - if (!leavingExpr && stream.match(symbol) || - stream.match(/:([<>]:|<<=?|>>>?=?|->|\/\/|\.{2,3}|[\.\\%*+\-<>!\/^|&]=?|[~\?\$])/)) { + if (!leavingExpr && (stream.match(symbol) || stream.match(symbolOperators))) { return "builtin"; } @@ -212,7 +220,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { return state.tokenize(stream, state); } - if (stream.match(macro)) { + if (stream.match(macro) || stream.match(macroOperators)) { return "meta"; } diff --git a/docs/snippets/node_modules/codemirror/mode/meta.js b/docs/snippets/node_modules/codemirror/mode/meta.js index 477d6ae2..38d5e013 100644 --- a/docs/snippets/node_modules/codemirror/mode/meta.js +++ b/docs/snippets/node_modules/codemirror/mode/meta.js @@ -19,7 +19,7 @@ {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]}, {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]}, {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, - {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, + {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy", "cbl"]}, {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]}, {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]}, {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]}, diff --git a/docs/snippets/node_modules/codemirror/mode/nsis/nsis.js b/docs/snippets/node_modules/codemirror/mode/nsis/nsis.js index 636940f5..2b1c5fb9 100644 --- a/docs/snippets/node_modules/codemirror/mode/nsis/nsis.js +++ b/docs/snippets/node_modules/codemirror/mode/nsis/nsis.js @@ -24,14 +24,14 @@ CodeMirror.defineSimpleMode("nsis",{ { regex: /`(?:[^\\`]|\\.)*`?/, token: "string" }, // Compile Time Commands - {regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace))\b/, token: "keyword"}, + {regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/, token: "keyword"}, // Conditional Compilation {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true}, {regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true}, // Runtime Commands - {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"}, + {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"}, {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true}, {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true}, diff --git a/docs/snippets/node_modules/codemirror/mode/php/php.js b/docs/snippets/node_modules/codemirror/mode/php/php.js index b2cae960..127b4a23 100644 --- a/docs/snippets/node_modules/codemirror/mode/php/php.js +++ b/docs/snippets/node_modules/codemirror/mode/php/php.js @@ -80,11 +80,11 @@ } var phpKeywords = "abstract and array as break case catch class clone const continue declare default " + - "do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final " + + "do else elseif enddeclare endfor endforeach endif endswitch endwhile enum extends final " + "for foreach function global goto if implements interface instanceof namespace " + "new or private protected public static switch throw trait try use var while xor " + "die echo empty exit eval include include_once isset list require require_once return " + - "print unset __halt_compiler self static parent yield insteadof finally"; + "print unset __halt_compiler self static parent yield insteadof finally readonly match"; var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"; var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage memory_get_peak_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count"; CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" ")); @@ -95,7 +95,7 @@ helperType: "php", keywords: keywords(phpKeywords), blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"), - defKeywords: keywords("class function interface namespace trait"), + defKeywords: keywords("class enum function interface namespace trait"), atoms: keywords(phpAtoms), builtin: keywords(phpBuiltin), multiLineStrings: true, diff --git a/docs/snippets/node_modules/codemirror/mode/python/python.js b/docs/snippets/node_modules/codemirror/mode/python/python.js index 7dff2d1e..9e532ea1 100644 --- a/docs/snippets/node_modules/codemirror/mode/python/python.js +++ b/docs/snippets/node_modules/codemirror/mode/python/python.js @@ -62,7 +62,7 @@ var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/; myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]); myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]); - var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i"); + var stringPrefixes = new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i"); } else { var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/; myKeywords = myKeywords.concat(["exec", "print"]); @@ -298,7 +298,10 @@ } function tokenLexer(stream, state) { - if (stream.sol()) state.beginningOfLine = true; + if (stream.sol()) { + state.beginningOfLine = true; + state.dedent = false; + } var style = state.tokenize(stream, state); var current = stream.current(); @@ -315,7 +318,7 @@ // Handle scope changes. if (current == "pass" || current == "return") - state.dedent += 1; + state.dedent = true; if (current == "lambda") state.lambda = true; if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false)) @@ -332,10 +335,8 @@ else return ERRORCLASS; } } - if (state.dedent > 0 && stream.eol() && top(state).type == "py") { - if (state.scopes.length > 1) state.scopes.pop(); - state.dedent -= 1; - } + if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1) + state.scopes.pop(); return style; } @@ -370,14 +371,16 @@ if (state.tokenize != tokenBase) return state.tokenize.isString ? CodeMirror.Pass : 0; - var scope = top(state), closing = scope.type == textAfter.charAt(0) + var scope = top(state) + var closing = scope.type == textAfter.charAt(0) || + scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter) if (scope.align != null) return scope.align - (closing ? 1 : 0) else return scope.offset - (closing ? hangingIndent : 0) }, - electricInput: /^\s*[\}\]\)]$/, + electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/, closeBrackets: {triples: "'\""}, lineComment: "#", fold: "indent" diff --git a/docs/snippets/node_modules/codemirror/mode/soy/soy.js b/docs/snippets/node_modules/codemirror/mode/soy/soy.js index 1f8a13c4..debe7268 100644 --- a/docs/snippets/node_modules/codemirror/mode/soy/soy.js +++ b/docs/snippets/node_modules/codemirror/mode/soy/soy.js @@ -24,6 +24,8 @@ "@inject?": paramData, "@state": paramData, "template": { soyState: "templ-def", variableScope: true}, + "extern": {soyState: "param-def"}, + "export": {soyState: "export"}, "literal": { }, "msg": {}, "fallbackmsg": { noEndTag: true, reduceIndent: true}, @@ -31,6 +33,8 @@ "plural": {}, "let": { soyState: "var-def" }, "if": {}, + "javaimpl": {}, + "jsimpl": {}, "elseif": { noEndTag: true, reduceIndent: true}, "else": { noEndTag: true, reduceIndent: true}, "switch": {}, @@ -46,6 +50,8 @@ "delcall": { soyState: "templ-ref" }, "log": {}, "element": { variableScope: true }, + "velog": {}, + "const": { soyState: "const-def"}, }; var indentingTags = Object.keys(tags).filter(function(tag) { @@ -134,10 +140,10 @@ state.context = new Context(state.context, "list-literal", state.variables); state.lookupVariables = false; return null; - } else if (stream.match(/map\b/)) { + } else if (stream.match(/\bmap(?=\()/)) { state.soyState.push("map-literal"); return "keyword"; - } else if (stream.match(/record\b/)) { + } else if (stream.match(/\brecord(?=\()/)) { state.soyState.push("record-literal"); return "keyword"; } else if (stream.match(/([\w]+)(?=\()/)) { @@ -448,11 +454,11 @@ state.indent -= 2 * config.indentUnit; return null; } - if (stream.match(/\w+(?=\s+as)/)) { + if (stream.match(/\w+(?=\s+as\b)/)) { return "variable"; } if (match = stream.match(/\w+/)) { - return /(from|as)/.test(match[0]) ? "keyword" : "def"; + return /\b(from|as)\b/.test(match[0]) ? "keyword" : "def"; } if (match = stream.match(/^["']/)) { state.soyState.push("string"); @@ -522,6 +528,27 @@ return this.token(stream, state); } return tokenUntil(stream, state, /\{\/literal}/); + case "export": + if (match = stream.match(/\w+/)) { + state.soyState.pop(); + if (match == "const") { + state.soyState.push("const-def") + return "keyword"; + } else if (match == "extern") { + state.soyState.push("param-def") + return "keyword"; + } + } else { + stream.next(); + } + return null; + case "const-def": + if (stream.match(/^\w+/)) { + state.soyState.pop(); + return "def"; + } + stream.next(); + return null; } if (stream.match('{literal}')) { @@ -552,7 +579,8 @@ state.context = new Context(state.context, state.tag, tag.variableScope ? state.variables : null); // Otherwise close the current context. } else if (endTag) { - if (!state.context || state.context.tag != tagName) { + var isBalancedForExtern = tagName == 'extern' && (state.context && state.context.tag == 'export'); + if (!state.context || ((state.context.tag != tagName) && !isBalancedForExtern)) { tagError = true; } else if (state.context) { if (state.context.kind) { @@ -577,7 +605,7 @@ state.indent += 2 * config.indentUnit; state.soyState.push("tag"); return "keyword"; - } else if (!state.context && stream.match(/\bimport\b/)) { + } else if (!state.context && stream.sol() && stream.match(/import\b/)) { state.soyState.push("import"); state.indent += 2 * config.indentUnit; return "keyword"; diff --git a/docs/snippets/node_modules/codemirror/mode/sql/sql.js b/docs/snippets/node_modules/codemirror/mode/sql/sql.js index ead4d6db..7b9014b7 100644 --- a/docs/snippets/node_modules/codemirror/mode/sql/sql.js +++ b/docs/snippets/node_modules/codemirror/mode/sql/sql.js @@ -332,7 +332,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-mariadb", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), + keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=&|^]/, @@ -452,7 +452,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-sparksql", { name: "sql", keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"), - builtin: set("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"), + builtin: set("abs acos acosh add_months aggregate and any approx_count_distinct approx_percentile array array_contains array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_repeat array_sort array_union arrays_overlap arrays_zip ascii asin asinh assert_true atan atan2 atanh avg base64 between bigint bin binary bit_and bit_count bit_get bit_length bit_or bit_xor bool_and bool_or boolean bround btrim cardinality case cast cbrt ceil ceiling char char_length character_length chr coalesce collect_list collect_set concat concat_ws conv corr cos cosh cot count count_if count_min_sketch covar_pop covar_samp crc32 cume_dist current_catalog current_database current_date current_timestamp current_timezone current_user date date_add date_format date_from_unix_date date_part date_sub date_trunc datediff day dayofmonth dayofweek dayofyear decimal decode degrees delimited dense_rank div double e element_at elt encode every exists exp explode explode_outer expm1 extract factorial filter find_in_set first first_value flatten float floor forall format_number format_string from_csv from_json from_unixtime from_utc_timestamp get_json_object getbit greatest grouping grouping_id hash hex hour hypot if ifnull in initcap inline inline_outer input_file_block_length input_file_block_start input_file_name inputformat instr int isnan isnotnull isnull java_method json_array_length json_object_keys json_tuple kurtosis lag last last_day last_value lcase lead least left length levenshtein like ln locate log log10 log1p log2 lower lpad ltrim make_date make_dt_interval make_interval make_timestamp make_ym_interval map map_concat map_entries map_filter map_from_arrays map_from_entries map_keys map_values map_zip_with max max_by md5 mean min min_by minute mod monotonically_increasing_id month months_between named_struct nanvl negative next_day not now nth_value ntile nullif nvl nvl2 octet_length or outputformat overlay parse_url percent_rank percentile percentile_approx pi pmod posexplode posexplode_outer position positive pow power printf quarter radians raise_error rand randn random rank rcfile reflect regexp regexp_extract regexp_extract_all regexp_like regexp_replace repeat replace reverse right rint rlike round row_number rpad rtrim schema_of_csv schema_of_json second sentences sequence sequencefile serde session_window sha sha1 sha2 shiftleft shiftright shiftrightunsigned shuffle sign signum sin sinh size skewness slice smallint some sort_array soundex space spark_partition_id split sqrt stack std stddev stddev_pop stddev_samp str_to_map string struct substr substring substring_index sum tan tanh textfile timestamp timestamp_micros timestamp_millis timestamp_seconds tinyint to_csv to_date to_json to_timestamp to_unix_timestamp to_utc_timestamp transform transform_keys transform_values translate trim trunc try_add try_divide typeof ucase unbase64 unhex uniontype unix_date unix_micros unix_millis unix_seconds unix_timestamp upper uuid var_pop var_samp variance version weekday weekofyear when width_bucket window xpath xpath_boolean xpath_double xpath_float xpath_int xpath_long xpath_number xpath_short xpath_string xxhash64 year zip_with"), atoms: set("false true null"), operatorChars: /^[*\/+\-%<>!=~&|^]/, dateSQL: set("date time timestamp"), diff --git a/docs/snippets/node_modules/codemirror/mode/stylus/stylus.js b/docs/snippets/node_modules/codemirror/mode/stylus/stylus.js index 5cddff03..730a8c51 100644 --- a/docs/snippets/node_modules/codemirror/mode/stylus/stylus.js +++ b/docs/snippets/node_modules/codemirror/mode/stylus/stylus.js @@ -737,12 +737,12 @@ // Note, "url-prefix" should precede "url" in order to match correctly in documentTypesRegexp var documentTypes_ = ["domain", "regexp", "url-prefix", "url"]; var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]; - var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]; + var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","dynamic-range","video-dynamic-range"]; var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"]; var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"]; var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]; var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]; - var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"]; + var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","high","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","standard","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"]; var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"], blockKeywords_ = ["for","if","else","unless", "from", "to"], diff --git a/docs/snippets/node_modules/codemirror/mode/xml/xml.js b/docs/snippets/node_modules/codemirror/mode/xml/xml.js index 46806ac4..4e36106b 100644 --- a/docs/snippets/node_modules/codemirror/mode/xml/xml.js +++ b/docs/snippets/node_modules/codemirror/mode/xml/xml.js @@ -187,6 +187,10 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { }; } + function lower(tagName) { + return tagName && tagName.toLowerCase(); + } + function Context(state, tagName, startOfLine) { this.prev = state.context; this.tagName = tagName || ""; @@ -205,8 +209,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { return; } parentTagName = state.context.tagName; - if (!config.contextGrabbers.hasOwnProperty(parentTagName) || - !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { + if (!config.contextGrabbers.hasOwnProperty(lower(parentTagName)) || + !config.contextGrabbers[lower(parentTagName)].hasOwnProperty(lower(nextTagName))) { return; } popContext(state); @@ -240,7 +244,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { if (type == "word") { var tagName = stream.current(); if (state.context && state.context.tagName != tagName && - config.implicitlyClosed.hasOwnProperty(state.context.tagName)) + config.implicitlyClosed.hasOwnProperty(lower(state.context.tagName))) popContext(state); if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) { setStyle = "tag"; @@ -279,7 +283,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { var tagName = state.tagName, tagStart = state.tagStart; state.tagName = state.tagStart = null; if (type == "selfcloseTag" || - config.autoSelfClosers.hasOwnProperty(tagName)) { + config.autoSelfClosers.hasOwnProperty(lower(tagName))) { maybePopContext(state, tagName); } else { maybePopContext(state, tagName); @@ -359,7 +363,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { if (context.tagName == tagAfter[2]) { context = context.prev; break; - } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) { + } else if (config.implicitlyClosed.hasOwnProperty(lower(context.tagName))) { context = context.prev; } else { break; @@ -367,8 +371,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { } } else if (tagAfter) { // Opening tag spotted while (context) { - var grabbers = config.contextGrabbers[context.tagName]; - if (grabbers && grabbers.hasOwnProperty(tagAfter[2])) + var grabbers = config.contextGrabbers[lower(context.tagName)]; + if (grabbers && grabbers.hasOwnProperty(lower(tagAfter[2]))) context = context.prev; else break; diff --git a/docs/snippets/node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js b/docs/snippets/node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js index 88c845e2..5c6175e4 100644 --- a/docs/snippets/node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +++ b/docs/snippets/node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js @@ -17,55 +17,55 @@ var yamlMode = CodeMirror.getMode(config, "yaml") var innerMode = CodeMirror.getMode(config, parserConfig && parserConfig.base || "gfm") - function curMode(state) { - return state.state == BODY ? innerMode : yamlMode + function localMode(state) { + return state.state == FRONTMATTER ? {mode: yamlMode, state: state.yaml} : {mode: innerMode, state: state.inner} } return { startState: function () { return { state: START, - inner: CodeMirror.startState(yamlMode) + yaml: null, + inner: CodeMirror.startState(innerMode) } }, copyState: function (state) { return { state: state.state, - inner: CodeMirror.copyState(curMode(state), state.inner) + yaml: state.yaml && CodeMirror.copyState(yamlMode, state.yaml), + inner: CodeMirror.copyState(innerMode, state.inner) } }, token: function (stream, state) { if (state.state == START) { if (stream.match('---', false)) { state.state = FRONTMATTER - return yamlMode.token(stream, state.inner) + state.yaml = CodeMirror.startState(yamlMode) + return yamlMode.token(stream, state.yaml) } else { state.state = BODY - state.inner = CodeMirror.startState(innerMode) return innerMode.token(stream, state.inner) } } else if (state.state == FRONTMATTER) { var end = stream.sol() && stream.match(/(---|\.\.\.)/, false) - var style = yamlMode.token(stream, state.inner) + var style = yamlMode.token(stream, state.yaml) if (end) { state.state = BODY - state.inner = CodeMirror.startState(innerMode) + state.yaml = null } return style } else { return innerMode.token(stream, state.inner) } }, - innerMode: function (state) { - return {mode: curMode(state), state: state.inner} - }, + innerMode: localMode, indent: function(state, a, b) { - var mode = curMode(state) - return mode.indent ? mode.indent(state.inner, a, b) : CodeMirror.Pass + var m = localMode(state) + return m.mode.indent ? m.mode.indent(m.state, a, b) : CodeMirror.Pass }, blankLine: function (state) { - var mode = curMode(state) - if (mode.blankLine) return mode.blankLine(state.inner) + var m = localMode(state) + if (m.mode.blankLine) return m.mode.blankLine(m.state) } } }) diff --git a/docs/snippets/node_modules/codemirror/package.json b/docs/snippets/node_modules/codemirror/package.json index 5a8b66ec..d8cc07b7 100644 --- a/docs/snippets/node_modules/codemirror/package.json +++ b/docs/snippets/node_modules/codemirror/package.json @@ -1,8 +1,8 @@ { "_from": "codemirror@^5.49.2", - "_id": "codemirror@5.61.1", + "_id": "codemirror@5.64.0", "_inBundle": false, - "_integrity": "sha512-+D1NZjAucuzE93vJGbAaXzvoBHwp9nJZWWWF9utjv25+5AZUiah6CIlfb4ikG4MoDsFsCG8niiJH5++OO2LgIQ==", + "_integrity": "sha512-fqr6CtDQdJ6iNMbD8NX2gH2G876nNDk+TO1rrYkgWnqQdO3O1Xa9tK6q+psqhJJgE5SpbaDcgdfLmukoUVE8pg==", "_location": "/codemirror", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/jscoq" ], - "_resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.61.1.tgz", - "_shasum": "ccfc8a43b8fcfb8b12e8e75b5ffde48d541406e0", + "_resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.64.0.tgz", + "_shasum": "182eec65b62178e3cd1de8f9d88ab819cfe5f625", "_spec": "codemirror@^5.49.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "Marijn Haverbeke", "email": "marijnh@gmail.com", @@ -98,6 +98,9 @@ { "name": "Ahmad M. Zawawi" }, + { + "name": "AHOHNMYC" + }, { "name": "ahoward" }, @@ -266,12 +269,18 @@ { "name": "Anthony Grimes" }, + { + "name": "Anthony Stewart" + }, { "name": "Anton Kovalyov" }, { "name": "antosarho" }, + { + "name": "aoki ken" + }, { "name": "Apollo Zhu" }, @@ -383,6 +392,9 @@ { "name": "BigBlueHat" }, + { + "name": "Billiam" + }, { "name": "Billy Moon" }, @@ -530,6 +542,9 @@ { "name": "Christian Petrov" }, + { + "name": "Christian Sonne" + }, { "name": "christopherblaser" }, @@ -713,6 +728,9 @@ { "name": "Dimage Sapelkin" }, + { + "name": "Dimitri Mitropoulos" + }, { "name": "Dinindu D. Wanniarachchi" }, @@ -1143,6 +1161,9 @@ { "name": "Jake Peyser" }, + { + "name": "Jake Zimmerman" + }, { "name": "Jakob Kummerow" }, @@ -1318,6 +1339,9 @@ { "name": "John Snelson" }, + { + "name": "johnspiegel" + }, { "name": "John Van Der Loo" }, @@ -1432,6 +1456,9 @@ { "name": "Kayur Patel" }, + { + "name": "Kazuhisa Ishizaka" + }, { "name": "Kazuhito Hokamura" }, @@ -1549,6 +1576,9 @@ { "name": "Leonya Khachaturov" }, + { + "name": "lexer2086" + }, { "name": "Liam Newman" }, @@ -1891,6 +1921,9 @@ { "name": "Milan Szekely" }, + { + "name": "MinJune Kim" + }, { "name": "MinRK" }, @@ -1934,6 +1967,9 @@ { "name": "Mu-An Chiou" }, + { + "name": "Mykola Martynovets" + }, { "name": "mzabuawala" }, @@ -2046,6 +2082,9 @@ { "name": "Olivia Ytterbrink" }, + { + "name": "OndÅ™ej Mirtes" + }, { "name": "Opender Singh" }, @@ -2199,6 +2238,9 @@ { "name": "Prendota" }, + { + "name": "ps173" + }, { "name": "Qiang Li" }, @@ -2298,12 +2340,18 @@ { "name": "Roman Janusz" }, + { + "name": "Rongjian Zhang" + }, { "name": "Rrandom" }, { "name": "Rrrandom" }, + { + "name": "Ruslan Bekenev" + }, { "name": "Ruslan Osmanov" }, @@ -2325,6 +2373,9 @@ { "name": "sabaca" }, + { + "name": "Sachin Gupta" + }, { "name": "Sam Lee" }, @@ -2487,6 +2538,9 @@ { "name": "Stas Kobzar" }, + { + "name": "stasoid" + }, { "name": "Stefan Borsje" }, @@ -2511,6 +2565,9 @@ { "name": "Steve Hoover" }, + { + "name": "Steven Yung" + }, { "name": "Steve O'Hara" }, @@ -2748,9 +2805,15 @@ { "name": "Will Binns-Smith" }, + { + "name": "Will Cassella" + }, { "name": "Will Dean" }, + { + "name": "Will Hernandez" + }, { "name": "William Desportes" }, @@ -2869,5 +2932,5 @@ "watch": "rollup -w -c" }, "style": "lib/codemirror.css", - "version": "5.61.1" + "version": "5.64.0" } diff --git a/docs/snippets/node_modules/codemirror/src/display/Display.js b/docs/snippets/node_modules/codemirror/src/display/Display.js index d57f00bd..9d4c0360 100644 --- a/docs/snippets/node_modules/codemirror/src/display/Display.js +++ b/docs/snippets/node_modules/codemirror/src/display/Display.js @@ -49,6 +49,10 @@ export function Display(place, doc, input, options) { // The element in which the editor lives. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror") + // This attribute is respected by automatic translation systems such as Google Translate, + // and may also be respected by tools used by human translators. + d.wrapper.setAttribute('translate', 'no') + // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 } if (!webkit && !(gecko && mobile)) d.scroller.draggable = true diff --git a/docs/snippets/node_modules/codemirror/src/display/scroll_events.js b/docs/snippets/node_modules/codemirror/src/display/scroll_events.js index fbed4266..5c6173ac 100644 --- a/docs/snippets/node_modules/codemirror/src/display/scroll_events.js +++ b/docs/snippets/node_modules/codemirror/src/display/scroll_events.js @@ -41,6 +41,12 @@ export function wheelEventPixels(e) { export function onScrollWheel(cm, e) { let delta = wheelEventDelta(e), dx = delta.x, dy = delta.y + let pixelsPerUnit = wheelPixelsPerUnit + if (e.deltaMode === 0) { + dx = e.deltaX + dy = e.deltaY + pixelsPerUnit = 1 + } let display = cm.display, scroll = display.scroller // Quit if there's nothing to scroll here @@ -69,10 +75,10 @@ export function onScrollWheel(cm, e) { // estimated pixels/delta value, we just handle horizontal // scrolling entirely here. It'll be slightly off from native, but // better than glitching out. - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { + if (dx && !gecko && !presto && pixelsPerUnit != null) { if (dy && canScrollY) - updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)) - setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)) + updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)) + setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit)) // Only prevent default scrolling if vertical scrolling is // actually possible. Otherwise, it causes vertical scroll // jitter on OSX trackpads when deltaX is small and deltaY @@ -85,15 +91,15 @@ export function onScrollWheel(cm, e) { // 'Project' the visible viewport to cover the area that is being // scrolled into view (if we know enough to estimate it). - if (dy && wheelPixelsPerUnit != null) { - let pixels = dy * wheelPixelsPerUnit + if (dy && pixelsPerUnit != null) { + let pixels = dy * pixelsPerUnit let top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight if (pixels < 0) top = Math.max(0, top + pixels - 50) else bot = Math.min(cm.doc.height, bot + pixels + 50) updateDisplaySimple(cm, {top: top, bottom: bot}) } - if (wheelSamples < 20) { + if (wheelSamples < 20 && e.deltaMode !== 0) { if (display.wheelStartX == null) { display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop display.wheelDX = dx; display.wheelDY = dy diff --git a/docs/snippets/node_modules/codemirror/src/display/scrollbars.js b/docs/snippets/node_modules/codemirror/src/display/scrollbars.js index 18ac121a..f77ffc19 100644 --- a/docs/snippets/node_modules/codemirror/src/display/scrollbars.js +++ b/docs/snippets/node_modules/codemirror/src/display/scrollbars.js @@ -60,6 +60,7 @@ class NativeScrollbars { this.vert.firstChild.style.height = Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px" } else { + this.vert.scrollTop = 0 this.vert.style.display = "" this.vert.firstChild.style.height = "0" } diff --git a/docs/snippets/node_modules/codemirror/src/display/selection.js b/docs/snippets/node_modules/codemirror/src/display/selection.js index d377a9f4..f53c7907 100644 --- a/docs/snippets/node_modules/codemirror/src/display/selection.js +++ b/docs/snippets/node_modules/codemirror/src/display/selection.js @@ -15,13 +15,19 @@ export function prepareSelection(cm, primary = true) { let curFragment = result.cursors = document.createDocumentFragment() let selFragment = result.selection = document.createDocumentFragment() + let customCursor = cm.options.$customCursor + if (customCursor) primary = true for (let i = 0; i < doc.sel.ranges.length; i++) { if (!primary && i == doc.sel.primIndex) continue let range = doc.sel.ranges[i] if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue let collapsed = range.empty() - if (collapsed || cm.options.showCursorWhenSelecting) + if (customCursor) { + let head = customCursor(cm, range) + if (head) drawSelectionCursor(cm, head, curFragment) + } else if (collapsed || cm.options.showCursorWhenSelecting) { drawSelectionCursor(cm, range.head, curFragment) + } if (!collapsed) drawSelectionRange(cm, range, selFragment) } @@ -37,6 +43,12 @@ export function drawSelectionCursor(cm, head, output) { cursor.style.top = pos.top + "px" cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px" + if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) { + let charPos = charCoords(cm, head, "div", null, null) + let width = charPos.right - charPos.left + cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px" + } + if (pos.other) { // Secondary cursor, shown when on a 'jump' in bi-directional text let otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")) diff --git a/docs/snippets/node_modules/codemirror/src/display/update_lines.js b/docs/snippets/node_modules/codemirror/src/display/update_lines.js index 60c367e4..f09524b6 100644 --- a/docs/snippets/node_modules/codemirror/src/display/update_lines.js +++ b/docs/snippets/node_modules/codemirror/src/display/update_lines.js @@ -8,10 +8,14 @@ import { ie, ie_version } from "../util/browser.js" export function updateHeightsInViewport(cm) { let display = cm.display let prevBottom = display.lineDiv.offsetTop + let viewTop = Math.max(0, display.scroller.getBoundingClientRect().top) + let oldHeight = display.lineDiv.getBoundingClientRect().top + let mustScroll = 0 for (let i = 0; i < display.view.length; i++) { let cur = display.view[i], wrapping = cm.options.lineWrapping let height, width = 0 if (cur.hidden) continue + oldHeight += cur.line.height if (ie && ie_version < 8) { let bot = cur.node.offsetTop + cur.node.offsetHeight height = bot - prevBottom @@ -26,6 +30,7 @@ export function updateHeightsInViewport(cm) { } let diff = cur.line.height - height if (diff > .005 || diff < -.005) { + if (oldHeight < viewTop) mustScroll -= diff updateLineHeight(cur.line, height) updateWidgetHeight(cur.line) if (cur.rest) for (let j = 0; j < cur.rest.length; j++) @@ -40,6 +45,7 @@ export function updateHeightsInViewport(cm) { } } } + if (Math.abs(mustScroll) > 2) display.scroller.scrollTop += mustScroll } // Read and store the height of line widgets associated with the diff --git a/docs/snippets/node_modules/codemirror/src/edit/main.js b/docs/snippets/node_modules/codemirror/src/edit/main.js index 929a2bdc..85ef1032 100644 --- a/docs/snippets/node_modules/codemirror/src/edit/main.js +++ b/docs/snippets/node_modules/codemirror/src/edit/main.js @@ -66,4 +66,4 @@ import { addLegacyProps } from "./legacy.js" addLegacyProps(CodeMirror) -CodeMirror.version = "5.61.1" +CodeMirror.version = "5.64.0" diff --git a/docs/snippets/node_modules/codemirror/src/input/ContentEditableInput.js b/docs/snippets/node_modules/codemirror/src/input/ContentEditableInput.js index f5df0ebc..4845a4eb 100644 --- a/docs/snippets/node_modules/codemirror/src/input/ContentEditableInput.js +++ b/docs/snippets/node_modules/codemirror/src/input/ContentEditableInput.js @@ -226,7 +226,7 @@ export default class ContentEditableInput { receivedFocus() { let input = this if (this.selectionInEditor()) - this.pollSelection() + setTimeout(() => this.pollSelection(), 20) else runInOp(this.cm, () => input.cm.curOp.selectionChanged = true) diff --git a/docs/snippets/node_modules/codemirror/src/input/input.js b/docs/snippets/node_modules/codemirror/src/input/input.js index 32adbf9b..288937be 100644 --- a/docs/snippets/node_modules/codemirror/src/input/input.js +++ b/docs/snippets/node_modules/codemirror/src/input/input.js @@ -120,7 +120,7 @@ export function disableBrowserMagic(field, spellcheck, autocorrect, autocapitali } export function hiddenTextarea() { - let te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none") + let te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none") let div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;") // The textarea is kept positioned near the cursor to prevent the // fact that it'll be scrolled into view on input from scrolling diff --git a/docs/snippets/node_modules/codemirror/src/measurement/position_measurement.js b/docs/snippets/node_modules/codemirror/src/measurement/position_measurement.js index bb0ad50d..2748aca9 100644 --- a/docs/snippets/node_modules/codemirror/src/measurement/position_measurement.js +++ b/docs/snippets/node_modules/codemirror/src/measurement/position_measurement.js @@ -61,12 +61,14 @@ function ensureLineHeights(cm, lineView, rect) { export function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) return {map: lineView.measure.map, cache: lineView.measure.cache} - for (let i = 0; i < lineView.rest.length; i++) - if (lineView.rest[i] == line) - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} - for (let i = 0; i < lineView.rest.length; i++) - if (lineNo(lineView.rest[i]) > lineN) - return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true} + if (lineView.rest) { + for (let i = 0; i < lineView.rest.length; i++) + if (lineView.rest[i] == line) + return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} + for (let i = 0; i < lineView.rest.length; i++) + if (lineNo(lineView.rest[i]) > lineN) + return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true} + } } // Render a line into the hidden node display.externalMeasured. Used diff --git a/docs/snippets/node_modules/codemirror/src/model/Doc.js b/docs/snippets/node_modules/codemirror/src/model/Doc.js index 8a2082aa..3d2f7d23 100644 --- a/docs/snippets/node_modules/codemirror/src/model/Doc.js +++ b/docs/snippets/node_modules/codemirror/src/model/Doc.js @@ -86,6 +86,7 @@ Doc.prototype = createObj(BranchChunk.prototype, { getRange: function(from, to, lineSep) { let lines = getBetween(this, clipPos(this, from), clipPos(this, to)) if (lineSep === false) return lines + if (lineSep === '') return lines.join('') return lines.join(lineSep || this.lineSeparator()) }, diff --git a/docs/snippets/node_modules/codemirror/theme/ayu-dark.css b/docs/snippets/node_modules/codemirror/theme/ayu-dark.css index fd41ba3e..13656b94 100644 --- a/docs/snippets/node_modules/codemirror/theme/ayu-dark.css +++ b/docs/snippets/node_modules/codemirror/theme/ayu-dark.css @@ -9,6 +9,8 @@ .cm-s-ayu-dark .CodeMirror-guttermarker-subtle { color: #3d424d; } .cm-s-ayu-dark .CodeMirror-linenumber { color: #3d424d; } .cm-s-ayu-dark .CodeMirror-cursor { border-left: 1px solid #e6b450; } +.cm-s-ayu-dark.cm-fat-cursor .CodeMirror-cursor { background-color: #a2a8a175 !important; } +.cm-s-ayu-dark .cm-animate-fat-cursor { background-color: #a2a8a175 !important; } .cm-s-ayu-dark span.cm-comment { color: #626a73; } .cm-s-ayu-dark span.cm-atom { color: #ae81ff; } diff --git a/docs/snippets/node_modules/codemirror/theme/ayu-mirage.css b/docs/snippets/node_modules/codemirror/theme/ayu-mirage.css index 7a5b50ce..19403cef 100644 --- a/docs/snippets/node_modules/codemirror/theme/ayu-mirage.css +++ b/docs/snippets/node_modules/codemirror/theme/ayu-mirage.css @@ -8,7 +8,9 @@ .cm-s-ayu-mirage .CodeMirror-guttermarker { color: white; } .cm-s-ayu-mirage .CodeMirror-guttermarker-subtle { color: rgba(112, 122, 140, 66); } .cm-s-ayu-mirage .CodeMirror-linenumber { color: rgba(61, 66, 77, 99); } -.cm-s-ayu-mirage .CodeMirror-cursor { border-left: 1px solid #ffcc66; } +.cm-s-ayu-mirage .CodeMirror-cursor { border-left: 1px solid #ffcc66; } +.cm-s-ayu-mirage.cm-fat-cursor .CodeMirror-cursor {background-color: #a2a8a175 !important;} +.cm-s-ayu-mirage .cm-animate-fat-cursor { background-color: #a2a8a175 !important; } .cm-s-ayu-mirage span.cm-comment { color: #5c6773; font-style:italic; } .cm-s-ayu-mirage span.cm-atom { color: #ae81ff; } diff --git a/docs/snippets/node_modules/codemirror/theme/base16-dark.css b/docs/snippets/node_modules/codemirror/theme/base16-dark.css index 026a8168..b3c31aba 100644 --- a/docs/snippets/node_modules/codemirror/theme/base16-dark.css +++ b/docs/snippets/node_modules/codemirror/theme/base16-dark.css @@ -17,6 +17,8 @@ .cm-s-base16-dark .CodeMirror-guttermarker-subtle { color: #505050; } .cm-s-base16-dark .CodeMirror-linenumber { color: #505050; } .cm-s-base16-dark .CodeMirror-cursor { border-left: 1px solid #b0b0b0; } +.cm-s-base16-dark.cm-fat-cursor .CodeMirror-cursor { background-color: #8e8d8875 !important; } +.cm-s-base16-dark .cm-animate-fat-cursor { background-color: #8e8d8875 !important; } .cm-s-base16-dark span.cm-comment { color: #8f5536; } .cm-s-base16-dark span.cm-atom { color: #aa759f; } diff --git a/docs/snippets/node_modules/codemirror/theme/gruvbox-dark.css b/docs/snippets/node_modules/codemirror/theme/gruvbox-dark.css index ded215f5..d712dda0 100644 --- a/docs/snippets/node_modules/codemirror/theme/gruvbox-dark.css +++ b/docs/snippets/node_modules/codemirror/theme/gruvbox-dark.css @@ -11,6 +11,8 @@ .cm-s-gruvbox-dark .CodeMirror-gutters {background: #282828; border-right: 0px;} .cm-s-gruvbox-dark .CodeMirror-linenumber {color: #7c6f64;} .cm-s-gruvbox-dark .CodeMirror-cursor { border-left: 1px solid #ebdbb2; } +.cm-s-gruvbox-dark.cm-fat-cursor .CodeMirror-cursor { background-color: #8e8d8875 !important; } +.cm-s-gruvbox-dark .cm-animate-fat-cursor { background-color: #8e8d8875 !important; } .cm-s-gruvbox-dark div.CodeMirror-selected { background: #928374; } .cm-s-gruvbox-dark span.cm-meta { color: #83a598; } diff --git a/docs/snippets/node_modules/codemirror/theme/juejin.css b/docs/snippets/node_modules/codemirror/theme/juejin.css new file mode 100644 index 00000000..38cf7fe3 --- /dev/null +++ b/docs/snippets/node_modules/codemirror/theme/juejin.css @@ -0,0 +1,30 @@ +.cm-s-juejin.CodeMirror { + background: #f8f9fa; +} +.cm-s-juejin .cm-header, +.cm-s-juejin .cm-def { + color: #1ba2f0; +} +.cm-s-juejin .cm-comment { + color: #009e9d; +} +.cm-s-juejin .cm-quote, +.cm-s-juejin .cm-link, +.cm-s-juejin .cm-strong, +.cm-s-juejin .cm-attribute { + color: #fd7741; +} +.cm-s-juejin .cm-url, +.cm-s-juejin .cm-keyword, +.cm-s-juejin .cm-builtin { + color: #bb51b8; +} +.cm-s-juejin .cm-hr { + color: #909090; +} +.cm-s-juejin .cm-tag { + color: #107000; +} +.cm-s-juejin .cm-variable-2 { + color: #0050a0; +} diff --git a/docs/snippets/node_modules/codemirror/theme/material-ocean.css b/docs/snippets/node_modules/codemirror/theme/material-ocean.css index 86a6f3cd..404178de 100644 --- a/docs/snippets/node_modules/codemirror/theme/material-ocean.css +++ b/docs/snippets/node_modules/codemirror/theme/material-ocean.css @@ -24,6 +24,12 @@ .cm-s-material-ocean .CodeMirror-cursor { border-left: 1px solid #FFCC00; } +.cm-s-material-ocean.cm-fat-cursor .CodeMirror-cursor { + background-color: #a2a8a175 !important; +} +.cm-s-material-ocean .cm-animate-fat-cursor { + background-color: #a2a8a175 !important; +} .cm-s-material-ocean div.CodeMirror-selected { background: rgba(113, 124, 180, 0.2); @@ -132,4 +138,4 @@ .cm-s-material-ocean .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; -} \ No newline at end of file +} diff --git a/docs/snippets/node_modules/codemirror/theme/material-palenight.css b/docs/snippets/node_modules/codemirror/theme/material-palenight.css index 66d53dd3..6712c43a 100644 --- a/docs/snippets/node_modules/codemirror/theme/material-palenight.css +++ b/docs/snippets/node_modules/codemirror/theme/material-palenight.css @@ -24,6 +24,12 @@ .cm-s-material-palenight .CodeMirror-cursor { border-left: 1px solid #FFCC00; } +.cm-s-material-palenight.cm-fat-cursor .CodeMirror-cursor { + background-color: #607c8b80 !important; +} +.cm-s-material-palenight .cm-animate-fat-cursor { + background-color: #607c8b80 !important; +} .cm-s-material-palenight div.CodeMirror-selected { background: rgba(113, 124, 180, 0.2); @@ -132,4 +138,4 @@ .cm-s-material-palenight .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; -} \ No newline at end of file +} diff --git a/docs/snippets/node_modules/codemirror/theme/material.css b/docs/snippets/node_modules/codemirror/theme/material.css index 9ac17a36..a7848499 100644 --- a/docs/snippets/node_modules/codemirror/theme/material.css +++ b/docs/snippets/node_modules/codemirror/theme/material.css @@ -24,6 +24,12 @@ .cm-s-material .CodeMirror-cursor { border-left: 1px solid #FFCC00; } +.cm-s-material.cm-fat-cursor .CodeMirror-cursor { + background-color: #5d6d5c80 !important; +} +.cm-s-material .cm-animate-fat-cursor { + background-color: #5d6d5c80 !important; +} .cm-s-material div.CodeMirror-selected { background: rgba(128, 203, 196, 0.2); @@ -132,4 +138,4 @@ .cm-s-material .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; -} \ No newline at end of file +} diff --git a/docs/snippets/node_modules/codemirror/theme/oceanic-next.css b/docs/snippets/node_modules/codemirror/theme/oceanic-next.css index 296277ba..f3d0d08a 100644 --- a/docs/snippets/node_modules/codemirror/theme/oceanic-next.css +++ b/docs/snippets/node_modules/codemirror/theme/oceanic-next.css @@ -16,6 +16,8 @@ .cm-s-oceanic-next .CodeMirror-guttermarker-subtle { color: #d0d0d0; } .cm-s-oceanic-next .CodeMirror-linenumber { color: #d0d0d0; } .cm-s-oceanic-next .CodeMirror-cursor { border-left: 1px solid #f8f8f0; } +.cm-s-oceanic-next.cm-fat-cursor .CodeMirror-cursor { background-color: #a2a8a175 !important; } +.cm-s-oceanic-next .cm-animate-fat-cursor { background-color: #a2a8a175 !important; } .cm-s-oceanic-next span.cm-comment { color: #65737E; } .cm-s-oceanic-next span.cm-atom { color: #C594C5; } diff --git a/docs/snippets/node_modules/codemirror/theme/solarized.css b/docs/snippets/node_modules/codemirror/theme/solarized.css index 9c6b1265..e978fec9 100644 --- a/docs/snippets/node_modules/codemirror/theme/solarized.css +++ b/docs/snippets/node_modules/codemirror/theme/solarized.css @@ -35,12 +35,10 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png .cm-s-solarized.cm-s-dark { color: #839496; background-color: #002b36; - text-shadow: #002b36 0 1px; } .cm-s-solarized.cm-s-light { background-color: #fdf6e3; color: #657b83; - text-shadow: #eee8d5 0 1px; } .cm-s-solarized .CodeMirror-widget { @@ -126,7 +124,6 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png .cm-s-solarized.cm-s-dark .CodeMirror-linenumber { color: #586e75; - text-shadow: #021014 0 -1px; } /* Light */ diff --git a/docs/snippets/node_modules/colors/package.json b/docs/snippets/node_modules/colors/package.json index c451aaaa..948163fb 100644 --- a/docs/snippets/node_modules/colors/package.json +++ b/docs/snippets/node_modules/colors/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "_shasum": "0433f44d809680fdeb60ed260f1b0c262e82a40b", "_spec": "colors@1.0.x", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/winston", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/winston", "author": { "name": "Marak Squires" }, diff --git a/docs/snippets/node_modules/commander/package.json b/docs/snippets/node_modules/commander/package.json index b8b67184..1946a7ae 100644 --- a/docs/snippets/node_modules/commander/package.json +++ b/docs/snippets/node_modules/commander/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "_shasum": "46abbd1652f8e059bddaef99bbdcb2ad9cf179ae", "_spec": "commander@^5.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" diff --git a/docs/snippets/node_modules/concat-map/package.json b/docs/snippets/node_modules/concat-map/package.json index 84a75995..efd9ec58 100644 --- a/docs/snippets/node_modules/concat-map/package.json +++ b/docs/snippets/node_modules/concat-map/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "_shasum": "d8a96bd77fd68df7793a73036a3ba0d5405d477b", "_spec": "concat-map@0.0.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/brace-expansion", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/brace-expansion", "author": { "name": "James Halliday", "email": "mail@substack.net", diff --git a/docs/snippets/node_modules/connect-ratelimit/package.json b/docs/snippets/node_modules/connect-ratelimit/package.json index 5239c247..81876a77 100644 --- a/docs/snippets/node_modules/connect-ratelimit/package.json +++ b/docs/snippets/node_modules/connect-ratelimit/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/connect-ratelimit/-/connect-ratelimit-0.0.7.tgz", "_shasum": "e6e09c950649e849499cab1870a415a07f731568", "_spec": "connect-ratelimit@0.0.7", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/@corwin.amber/hastebin", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/@corwin.amber/hastebin", "author": "", "bugs": { "url": "https://github.com/dharmafly/connect-ratelimit/issues" diff --git a/docs/snippets/node_modules/connect-route/package.json b/docs/snippets/node_modules/connect-route/package.json index f7ae6b66..ae8bca88 100644 --- a/docs/snippets/node_modules/connect-route/package.json +++ b/docs/snippets/node_modules/connect-route/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/connect-route/-/connect-route-0.1.5.tgz", "_shasum": "e3c218319d2e88a8a9ae0b0e0fe09a729c39744a", "_spec": "connect-route@0.1.5", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/@corwin.amber/hastebin", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/@corwin.amber/hastebin", "author": { "name": "Vadim M. Baryshev", "email": "vadimbaryshev@gmail.com" diff --git a/docs/snippets/node_modules/connect/package.json b/docs/snippets/node_modules/connect/package.json index bb83bbf6..ac54adc0 100644 --- a/docs/snippets/node_modules/connect/package.json +++ b/docs/snippets/node_modules/connect/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", "_shasum": "5d49348910caa5e07a01800b030d0c35f20484f8", "_spec": "connect@^3.7.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/@corwin.amber/hastebin", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/@corwin.amber/hastebin", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", diff --git a/docs/snippets/node_modules/content-disposition/package.json b/docs/snippets/node_modules/content-disposition/package.json index 6bb2ba03..589af2c4 100644 --- a/docs/snippets/node_modules/content-disposition/package.json +++ b/docs/snippets/node_modules/content-disposition/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", "_shasum": "e130caf7e7279087c5616c2007d0485698984fbd", "_spec": "content-disposition@0.5.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" diff --git a/docs/snippets/node_modules/content-type/package.json b/docs/snippets/node_modules/content-type/package.json index 52806dc4..b58127da 100644 --- a/docs/snippets/node_modules/content-type/package.json +++ b/docs/snippets/node_modules/content-type/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "_shasum": "e138cc75e040c727b1966fe5e5f8c9aee256fe3b", "_spec": "content-type@~1.0.4", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" diff --git a/docs/snippets/node_modules/cookie-signature/package.json b/docs/snippets/node_modules/cookie-signature/package.json index 17ff8cea..81485ac2 100644 --- a/docs/snippets/node_modules/cookie-signature/package.json +++ b/docs/snippets/node_modules/cookie-signature/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "_shasum": "e303a882b342cc3ee8ca513a79999734dab3ae2c", "_spec": "cookie-signature@1.0.6", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "TJ Holowaychuk", "email": "tj@learnboost.com" diff --git a/docs/snippets/node_modules/cookie/package.json b/docs/snippets/node_modules/cookie/package.json index c62f5ca0..a026e5a4 100644 --- a/docs/snippets/node_modules/cookie/package.json +++ b/docs/snippets/node_modules/cookie/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", "_shasum": "beb437e7022b3b6d49019d088665303ebe9c14ba", "_spec": "cookie@0.4.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "Roman Shtylman", "email": "shtylman@gmail.com" diff --git a/docs/snippets/node_modules/core-util-is/float.patch b/docs/snippets/node_modules/core-util-is/float.patch deleted file mode 100644 index a06d5c05..00000000 --- a/docs/snippets/node_modules/core-util-is/float.patch +++ /dev/null @@ -1,604 +0,0 @@ -diff --git a/lib/util.js b/lib/util.js -index a03e874..9074e8e 100644 ---- a/lib/util.js -+++ b/lib/util.js -@@ -19,430 +19,6 @@ - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - --var formatRegExp = /%[sdj%]/g; --exports.format = function(f) { -- if (!isString(f)) { -- var objects = []; -- for (var i = 0; i < arguments.length; i++) { -- objects.push(inspect(arguments[i])); -- } -- return objects.join(' '); -- } -- -- var i = 1; -- var args = arguments; -- var len = args.length; -- var str = String(f).replace(formatRegExp, function(x) { -- if (x === '%%') return '%'; -- if (i >= len) return x; -- switch (x) { -- case '%s': return String(args[i++]); -- case '%d': return Number(args[i++]); -- case '%j': -- try { -- return JSON.stringify(args[i++]); -- } catch (_) { -- return '[Circular]'; -- } -- default: -- return x; -- } -- }); -- for (var x = args[i]; i < len; x = args[++i]) { -- if (isNull(x) || !isObject(x)) { -- str += ' ' + x; -- } else { -- str += ' ' + inspect(x); -- } -- } -- return str; --}; -- -- --// Mark that a method should not be used. --// Returns a modified function which warns once by default. --// If --no-deprecation is set, then it is a no-op. --exports.deprecate = function(fn, msg) { -- // Allow for deprecating things in the process of starting up. -- if (isUndefined(global.process)) { -- return function() { -- return exports.deprecate(fn, msg).apply(this, arguments); -- }; -- } -- -- if (process.noDeprecation === true) { -- return fn; -- } -- -- var warned = false; -- function deprecated() { -- if (!warned) { -- if (process.throwDeprecation) { -- throw new Error(msg); -- } else if (process.traceDeprecation) { -- console.trace(msg); -- } else { -- console.error(msg); -- } -- warned = true; -- } -- return fn.apply(this, arguments); -- } -- -- return deprecated; --}; -- -- --var debugs = {}; --var debugEnviron; --exports.debuglog = function(set) { -- if (isUndefined(debugEnviron)) -- debugEnviron = process.env.NODE_DEBUG || ''; -- set = set.toUpperCase(); -- if (!debugs[set]) { -- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { -- var pid = process.pid; -- debugs[set] = function() { -- var msg = exports.format.apply(exports, arguments); -- console.error('%s %d: %s', set, pid, msg); -- }; -- } else { -- debugs[set] = function() {}; -- } -- } -- return debugs[set]; --}; -- -- --/** -- * Echos the value of a value. Trys to print the value out -- * in the best way possible given the different types. -- * -- * @param {Object} obj The object to print out. -- * @param {Object} opts Optional options object that alters the output. -- */ --/* legacy: obj, showHidden, depth, colors*/ --function inspect(obj, opts) { -- // default options -- var ctx = { -- seen: [], -- stylize: stylizeNoColor -- }; -- // legacy... -- if (arguments.length >= 3) ctx.depth = arguments[2]; -- if (arguments.length >= 4) ctx.colors = arguments[3]; -- if (isBoolean(opts)) { -- // legacy... -- ctx.showHidden = opts; -- } else if (opts) { -- // got an "options" object -- exports._extend(ctx, opts); -- } -- // set default options -- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; -- if (isUndefined(ctx.depth)) ctx.depth = 2; -- if (isUndefined(ctx.colors)) ctx.colors = false; -- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; -- if (ctx.colors) ctx.stylize = stylizeWithColor; -- return formatValue(ctx, obj, ctx.depth); --} --exports.inspect = inspect; -- -- --// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics --inspect.colors = { -- 'bold' : [1, 22], -- 'italic' : [3, 23], -- 'underline' : [4, 24], -- 'inverse' : [7, 27], -- 'white' : [37, 39], -- 'grey' : [90, 39], -- 'black' : [30, 39], -- 'blue' : [34, 39], -- 'cyan' : [36, 39], -- 'green' : [32, 39], -- 'magenta' : [35, 39], -- 'red' : [31, 39], -- 'yellow' : [33, 39] --}; -- --// Don't use 'blue' not visible on cmd.exe --inspect.styles = { -- 'special': 'cyan', -- 'number': 'yellow', -- 'boolean': 'yellow', -- 'undefined': 'grey', -- 'null': 'bold', -- 'string': 'green', -- 'date': 'magenta', -- // "name": intentionally not styling -- 'regexp': 'red' --}; -- -- --function stylizeWithColor(str, styleType) { -- var style = inspect.styles[styleType]; -- -- if (style) { -- return '\u001b[' + inspect.colors[style][0] + 'm' + str + -- '\u001b[' + inspect.colors[style][1] + 'm'; -- } else { -- return str; -- } --} -- -- --function stylizeNoColor(str, styleType) { -- return str; --} -- -- --function arrayToHash(array) { -- var hash = {}; -- -- array.forEach(function(val, idx) { -- hash[val] = true; -- }); -- -- return hash; --} -- -- --function formatValue(ctx, value, recurseTimes) { -- // Provide a hook for user-specified inspect functions. -- // Check that value is an object with an inspect function on it -- if (ctx.customInspect && -- value && -- isFunction(value.inspect) && -- // Filter out the util module, it's inspect function is special -- value.inspect !== exports.inspect && -- // Also filter out any prototype objects using the circular check. -- !(value.constructor && value.constructor.prototype === value)) { -- var ret = value.inspect(recurseTimes, ctx); -- if (!isString(ret)) { -- ret = formatValue(ctx, ret, recurseTimes); -- } -- return ret; -- } -- -- // Primitive types cannot have properties -- var primitive = formatPrimitive(ctx, value); -- if (primitive) { -- return primitive; -- } -- -- // Look up the keys of the object. -- var keys = Object.keys(value); -- var visibleKeys = arrayToHash(keys); -- -- if (ctx.showHidden) { -- keys = Object.getOwnPropertyNames(value); -- } -- -- // Some type of object without properties can be shortcutted. -- if (keys.length === 0) { -- if (isFunction(value)) { -- var name = value.name ? ': ' + value.name : ''; -- return ctx.stylize('[Function' + name + ']', 'special'); -- } -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } -- if (isDate(value)) { -- return ctx.stylize(Date.prototype.toString.call(value), 'date'); -- } -- if (isError(value)) { -- return formatError(value); -- } -- } -- -- var base = '', array = false, braces = ['{', '}']; -- -- // Make Array say that they are Array -- if (isArray(value)) { -- array = true; -- braces = ['[', ']']; -- } -- -- // Make functions say that they are functions -- if (isFunction(value)) { -- var n = value.name ? ': ' + value.name : ''; -- base = ' [Function' + n + ']'; -- } -- -- // Make RegExps say that they are RegExps -- if (isRegExp(value)) { -- base = ' ' + RegExp.prototype.toString.call(value); -- } -- -- // Make dates with properties first say the date -- if (isDate(value)) { -- base = ' ' + Date.prototype.toUTCString.call(value); -- } -- -- // Make error with message first say the error -- if (isError(value)) { -- base = ' ' + formatError(value); -- } -- -- if (keys.length === 0 && (!array || value.length == 0)) { -- return braces[0] + base + braces[1]; -- } -- -- if (recurseTimes < 0) { -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } else { -- return ctx.stylize('[Object]', 'special'); -- } -- } -- -- ctx.seen.push(value); -- -- var output; -- if (array) { -- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); -- } else { -- output = keys.map(function(key) { -- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); -- }); -- } -- -- ctx.seen.pop(); -- -- return reduceToSingleString(output, base, braces); --} -- -- --function formatPrimitive(ctx, value) { -- if (isUndefined(value)) -- return ctx.stylize('undefined', 'undefined'); -- if (isString(value)) { -- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') -- .replace(/'/g, "\\'") -- .replace(/\\"/g, '"') + '\''; -- return ctx.stylize(simple, 'string'); -- } -- if (isNumber(value)) { -- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, -- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . -- if (value === 0 && 1 / value < 0) -- return ctx.stylize('-0', 'number'); -- return ctx.stylize('' + value, 'number'); -- } -- if (isBoolean(value)) -- return ctx.stylize('' + value, 'boolean'); -- // For some reason typeof null is "object", so special case here. -- if (isNull(value)) -- return ctx.stylize('null', 'null'); --} -- -- --function formatError(value) { -- return '[' + Error.prototype.toString.call(value) + ']'; --} -- -- --function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { -- var output = []; -- for (var i = 0, l = value.length; i < l; ++i) { -- if (hasOwnProperty(value, String(i))) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- String(i), true)); -- } else { -- output.push(''); -- } -- } -- keys.forEach(function(key) { -- if (!key.match(/^\d+$/)) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- key, true)); -- } -- }); -- return output; --} -- -- --function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { -- var name, str, desc; -- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; -- if (desc.get) { -- if (desc.set) { -- str = ctx.stylize('[Getter/Setter]', 'special'); -- } else { -- str = ctx.stylize('[Getter]', 'special'); -- } -- } else { -- if (desc.set) { -- str = ctx.stylize('[Setter]', 'special'); -- } -- } -- if (!hasOwnProperty(visibleKeys, key)) { -- name = '[' + key + ']'; -- } -- if (!str) { -- if (ctx.seen.indexOf(desc.value) < 0) { -- if (isNull(recurseTimes)) { -- str = formatValue(ctx, desc.value, null); -- } else { -- str = formatValue(ctx, desc.value, recurseTimes - 1); -- } -- if (str.indexOf('\n') > -1) { -- if (array) { -- str = str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n').substr(2); -- } else { -- str = '\n' + str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n'); -- } -- } -- } else { -- str = ctx.stylize('[Circular]', 'special'); -- } -- } -- if (isUndefined(name)) { -- if (array && key.match(/^\d+$/)) { -- return str; -- } -- name = JSON.stringify('' + key); -- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { -- name = name.substr(1, name.length - 2); -- name = ctx.stylize(name, 'name'); -- } else { -- name = name.replace(/'/g, "\\'") -- .replace(/\\"/g, '"') -- .replace(/(^"|"$)/g, "'"); -- name = ctx.stylize(name, 'string'); -- } -- } -- -- return name + ': ' + str; --} -- -- --function reduceToSingleString(output, base, braces) { -- var numLinesEst = 0; -- var length = output.reduce(function(prev, cur) { -- numLinesEst++; -- if (cur.indexOf('\n') >= 0) numLinesEst++; -- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; -- }, 0); -- -- if (length > 60) { -- return braces[0] + -- (base === '' ? '' : base + '\n ') + -- ' ' + -- output.join(',\n ') + -- ' ' + -- braces[1]; -- } -- -- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; --} -- -- - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { -@@ -522,166 +98,10 @@ function isPrimitive(arg) { - exports.isPrimitive = isPrimitive; - - function isBuffer(arg) { -- return arg instanceof Buffer; -+ return Buffer.isBuffer(arg); - } - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); --} -- -- --function pad(n) { -- return n < 10 ? '0' + n.toString(10) : n.toString(10); --} -- -- --var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', -- 'Oct', 'Nov', 'Dec']; -- --// 26 Feb 16:19:34 --function timestamp() { -- var d = new Date(); -- var time = [pad(d.getHours()), -- pad(d.getMinutes()), -- pad(d.getSeconds())].join(':'); -- return [d.getDate(), months[d.getMonth()], time].join(' '); --} -- -- --// log is just a thin wrapper to console.log that prepends a timestamp --exports.log = function() { -- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); --}; -- -- --/** -- * Inherit the prototype methods from one constructor into another. -- * -- * The Function.prototype.inherits from lang.js rewritten as a standalone -- * function (not on Function.prototype). NOTE: If this file is to be loaded -- * during bootstrapping this function needs to be rewritten using some native -- * functions as prototype setup using normal JavaScript does not work as -- * expected during bootstrapping (see mirror.js in r114903). -- * -- * @param {function} ctor Constructor function which needs to inherit the -- * prototype. -- * @param {function} superCtor Constructor function to inherit prototype from. -- */ --exports.inherits = function(ctor, superCtor) { -- ctor.super_ = superCtor; -- ctor.prototype = Object.create(superCtor.prototype, { -- constructor: { -- value: ctor, -- enumerable: false, -- writable: true, -- configurable: true -- } -- }); --}; -- --exports._extend = function(origin, add) { -- // Don't do anything if add isn't an object -- if (!add || !isObject(add)) return origin; -- -- var keys = Object.keys(add); -- var i = keys.length; -- while (i--) { -- origin[keys[i]] = add[keys[i]]; -- } -- return origin; --}; -- --function hasOwnProperty(obj, prop) { -- return Object.prototype.hasOwnProperty.call(obj, prop); --} -- -- --// Deprecated old stuff. -- --exports.p = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- console.error(exports.inspect(arguments[i])); -- } --}, 'util.p: Use console.error() instead'); -- -- --exports.exec = exports.deprecate(function() { -- return require('child_process').exec.apply(this, arguments); --}, 'util.exec is now called `child_process.exec`.'); -- -- --exports.print = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(String(arguments[i])); -- } --}, 'util.print: Use console.log instead'); -- -- --exports.puts = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(arguments[i] + '\n'); -- } --}, 'util.puts: Use console.log instead'); -- -- --exports.debug = exports.deprecate(function(x) { -- process.stderr.write('DEBUG: ' + x + '\n'); --}, 'util.debug: Use console.error instead'); -- -- --exports.error = exports.deprecate(function(x) { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stderr.write(arguments[i] + '\n'); -- } --}, 'util.error: Use console.error instead'); -- -- --exports.pump = exports.deprecate(function(readStream, writeStream, callback) { -- var callbackCalled = false; -- -- function call(a, b, c) { -- if (callback && !callbackCalled) { -- callback(a, b, c); -- callbackCalled = true; -- } -- } -- -- readStream.addListener('data', function(chunk) { -- if (writeStream.write(chunk) === false) readStream.pause(); -- }); -- -- writeStream.addListener('drain', function() { -- readStream.resume(); -- }); -- -- readStream.addListener('end', function() { -- writeStream.end(); -- }); -- -- readStream.addListener('close', function() { -- call(); -- }); -- -- readStream.addListener('error', function(err) { -- writeStream.end(); -- call(err); -- }); -- -- writeStream.addListener('error', function(err) { -- readStream.destroy(); -- call(err); -- }); --}, 'util.pump(): Use readableStream.pipe() instead'); -- -- --var uv; --exports._errnoException = function(err, syscall) { -- if (isUndefined(uv)) uv = process.binding('uv'); -- var errname = uv.errname(err); -- var e = new Error(syscall + ' ' + errname); -- e.code = errname; -- e.errno = errname; -- e.syscall = syscall; -- return e; --}; -+} \ No newline at end of file diff --git a/docs/snippets/node_modules/core-util-is/lib/util.js b/docs/snippets/node_modules/core-util-is/lib/util.js index ff4c851c..6e5a20d7 100644 --- a/docs/snippets/node_modules/core-util-is/lib/util.js +++ b/docs/snippets/node_modules/core-util-is/lib/util.js @@ -100,7 +100,7 @@ function isPrimitive(arg) { } exports.isPrimitive = isPrimitive; -exports.isBuffer = Buffer.isBuffer; +exports.isBuffer = require('buffer').Buffer.isBuffer; function objectToString(o) { return Object.prototype.toString.call(o); diff --git a/docs/snippets/node_modules/core-util-is/package.json b/docs/snippets/node_modules/core-util-is/package.json index 5e22c25e..91ae00eb 100644 --- a/docs/snippets/node_modules/core-util-is/package.json +++ b/docs/snippets/node_modules/core-util-is/package.json @@ -1,8 +1,8 @@ { "_from": "core-util-is@~1.0.0", - "_id": "core-util-is@1.0.2", + "_id": "core-util-is@1.0.3", "_inBundle": false, - "_integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "_integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "_location": "/core-util-is", "_phantomChildren": {}, "_requested": { @@ -19,10 +19,10 @@ "/jszip/readable-stream", "/readable-stream" ], - "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", + "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "_shasum": "a6042d3634c2b27e9328f837b965fac83808db85", "_spec": "core-util-is@~1.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/readable-stream", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/readable-stream", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -35,8 +35,11 @@ "deprecated": false, "description": "The `util.is*` functions introduced in Node v0.12.", "devDependencies": { - "tap": "^2.3.0" + "tap": "^15.0.9" }, + "files": [ + "lib" + ], "homepage": "https://github.com/isaacs/core-util-is#readme", "keywords": [ "util", @@ -57,7 +60,10 @@ "url": "git://github.com/isaacs/core-util-is.git" }, "scripts": { + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags", + "preversion": "npm test", "test": "tap test.js" }, - "version": "1.0.2" + "version": "1.0.3" } diff --git a/docs/snippets/node_modules/core-util-is/test.js b/docs/snippets/node_modules/core-util-is/test.js deleted file mode 100644 index 1a490c65..00000000 --- a/docs/snippets/node_modules/core-util-is/test.js +++ /dev/null @@ -1,68 +0,0 @@ -var assert = require('tap'); - -var t = require('./lib/util'); - -assert.equal(t.isArray([]), true); -assert.equal(t.isArray({}), false); - -assert.equal(t.isBoolean(null), false); -assert.equal(t.isBoolean(true), true); -assert.equal(t.isBoolean(false), true); - -assert.equal(t.isNull(null), true); -assert.equal(t.isNull(undefined), false); -assert.equal(t.isNull(false), false); -assert.equal(t.isNull(), false); - -assert.equal(t.isNullOrUndefined(null), true); -assert.equal(t.isNullOrUndefined(undefined), true); -assert.equal(t.isNullOrUndefined(false), false); -assert.equal(t.isNullOrUndefined(), true); - -assert.equal(t.isNumber(null), false); -assert.equal(t.isNumber('1'), false); -assert.equal(t.isNumber(1), true); - -assert.equal(t.isString(null), false); -assert.equal(t.isString('1'), true); -assert.equal(t.isString(1), false); - -assert.equal(t.isSymbol(null), false); -assert.equal(t.isSymbol('1'), false); -assert.equal(t.isSymbol(1), false); -assert.equal(t.isSymbol(Symbol()), true); - -assert.equal(t.isUndefined(null), false); -assert.equal(t.isUndefined(undefined), true); -assert.equal(t.isUndefined(false), false); -assert.equal(t.isUndefined(), true); - -assert.equal(t.isRegExp(null), false); -assert.equal(t.isRegExp('1'), false); -assert.equal(t.isRegExp(new RegExp()), true); - -assert.equal(t.isObject({}), true); -assert.equal(t.isObject([]), true); -assert.equal(t.isObject(new RegExp()), true); -assert.equal(t.isObject(new Date()), true); - -assert.equal(t.isDate(null), false); -assert.equal(t.isDate('1'), false); -assert.equal(t.isDate(new Date()), true); - -assert.equal(t.isError(null), false); -assert.equal(t.isError({ err: true }), false); -assert.equal(t.isError(new Error()), true); - -assert.equal(t.isFunction(null), false); -assert.equal(t.isFunction({ }), false); -assert.equal(t.isFunction(function() {}), true); - -assert.equal(t.isPrimitive(null), true); -assert.equal(t.isPrimitive(''), true); -assert.equal(t.isPrimitive(0), true); -assert.equal(t.isPrimitive(new Date()), false); - -assert.equal(t.isBuffer(null), false); -assert.equal(t.isBuffer({}), false); -assert.equal(t.isBuffer(new Buffer(0)), true); diff --git a/docs/snippets/node_modules/cors/package.json b/docs/snippets/node_modules/cors/package.json index b7caa7de..99a935d5 100644 --- a/docs/snippets/node_modules/cors/package.json +++ b/docs/snippets/node_modules/cors/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", "_shasum": "eac11da51592dd86b9f06f6e7ac293b3df875d29", "_spec": "cors@^2.8.5", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/@corwin.amber/hastebin", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/@corwin.amber/hastebin", "author": { "name": "Troy Goode", "email": "troygoode@gmail.com", diff --git a/docs/snippets/node_modules/cycle/package.json b/docs/snippets/node_modules/cycle/package.json index 45cb83a6..74271055 100644 --- a/docs/snippets/node_modules/cycle/package.json +++ b/docs/snippets/node_modules/cycle/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", "_shasum": "21e80b2be8580f98b468f379430662b046c34ad2", "_spec": "cycle@1.0.x", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/winston", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/winston", "author": "", "bugs": { "url": "http://github.com/douglascrockford/JSON-js/issues" diff --git a/docs/snippets/node_modules/debug/package.json b/docs/snippets/node_modules/debug/package.json index 39e8c7f7..48d978f8 100644 --- a/docs/snippets/node_modules/debug/package.json +++ b/docs/snippets/node_modules/debug/package.json @@ -25,7 +25,7 @@ "_resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "_shasum": "5d128515df134ff327e90a4c93f4e077a536341f", "_spec": "debug@2.6.9", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" diff --git a/docs/snippets/node_modules/define-properties/package.json b/docs/snippets/node_modules/define-properties/package.json index 62c8c474..97d394b8 100644 --- a/docs/snippets/node_modules/define-properties/package.json +++ b/docs/snippets/node_modules/define-properties/package.json @@ -25,7 +25,7 @@ "_resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "_shasum": "cf88da6cbee26fe6db7094f61d870cbd84cee9f1", "_spec": "define-properties@^1.1.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/is-nan", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/is-nan", "author": { "name": "Jordan Harband" }, diff --git a/docs/snippets/node_modules/depd/package.json b/docs/snippets/node_modules/depd/package.json index 87b34a7a..8e6958fb 100644 --- a/docs/snippets/node_modules/depd/package.json +++ b/docs/snippets/node_modules/depd/package.json @@ -24,7 +24,7 @@ "_resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "_shasum": "9bcd52e14c097763e749b274c4346ed2e560b5a9", "_spec": "depd@~1.1.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" diff --git a/docs/snippets/node_modules/destroy/package.json b/docs/snippets/node_modules/destroy/package.json index ab896b22..2741fefd 100644 --- a/docs/snippets/node_modules/destroy/package.json +++ b/docs/snippets/node_modules/destroy/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "_shasum": "978857442c44749e4206613e37946205826abd80", "_spec": "destroy@~1.0.4", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/send", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/send", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", diff --git a/docs/snippets/node_modules/dicer/package.json b/docs/snippets/node_modules/dicer/package.json index 3709f06d..3063a13a 100644 --- a/docs/snippets/node_modules/dicer/package.json +++ b/docs/snippets/node_modules/dicer/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.3.tgz", "_shasum": "f00281189a55c2351ef80490a4fe9fb2c59c4939", "_spec": "dicer@0.2.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/busboy", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/busboy", "author": { "name": "Brian White", "email": "mscdex@mscdex.net" diff --git a/docs/snippets/node_modules/ee-first/package.json b/docs/snippets/node_modules/ee-first/package.json index 98ede3d8..b00127d6 100644 --- a/docs/snippets/node_modules/ee-first/package.json +++ b/docs/snippets/node_modules/ee-first/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "_shasum": "590c61156b0ae2f4f0255732a158b266bc56b21d", "_spec": "ee-first@1.1.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/on-finished", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/on-finished", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", diff --git a/docs/snippets/node_modules/encodeurl/package.json b/docs/snippets/node_modules/encodeurl/package.json index c5e3a439..be61c839 100644 --- a/docs/snippets/node_modules/encodeurl/package.json +++ b/docs/snippets/node_modules/encodeurl/package.json @@ -24,7 +24,7 @@ "_resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "_shasum": "ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59", "_spec": "encodeurl@~1.0.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "bugs": { "url": "https://github.com/pillarjs/encodeurl/issues" }, diff --git a/docs/snippets/node_modules/es-abstract/.eslintrc b/docs/snippets/node_modules/es-abstract/.eslintrc index 1a0d2d2b..c1e4e579 100644 --- a/docs/snippets/node_modules/es-abstract/.eslintrc +++ b/docs/snippets/node_modules/es-abstract/.eslintrc @@ -46,10 +46,13 @@ ], "extends": "@ljharb/eslint-config/node/latest", "rules": { + "complexity": 0, "func-style": 0, "max-lines-per-function": 0, "max-nested-callbacks": 0, + "max-statements": 0, "no-throw-literal": 0, + "operator-linebreak": [2, "before"], }, }, { diff --git a/docs/snippets/node_modules/es-abstract/.gitattributes b/docs/snippets/node_modules/es-abstract/.gitattributes deleted file mode 100644 index cbdb52f9..00000000 --- a/docs/snippets/node_modules/es-abstract/.gitattributes +++ /dev/null @@ -1,625 +0,0 @@ -2015/AbstractRelationalComparison.js spackled linguist-generated=true -2015/DateFromTime.js spackled linguist-generated=true -2015/Day.js spackled linguist-generated=true -2015/DayFromYear.js spackled linguist-generated=true -2015/DayWithinYear.js spackled linguist-generated=true -2015/DaysInYear.js spackled linguist-generated=true -2015/HourFromTime.js spackled linguist-generated=true -2015/InLeapYear.js spackled linguist-generated=true -2015/IsCallable.js spackled linguist-generated=true -2015/IsPropertyDescriptor.js spackled linguist-generated=true -2015/MakeDate.js spackled linguist-generated=true -2015/MakeDay.js spackled linguist-generated=true -2015/MakeTime.js spackled linguist-generated=true -2015/MinFromTime.js spackled linguist-generated=true -2015/MonthFromTime.js spackled linguist-generated=true -2015/SameValue.js spackled linguist-generated=true -2015/SecFromTime.js spackled linguist-generated=true -2015/StrictEqualityComparison.js spackled linguist-generated=true -2015/TimeClip.js spackled linguist-generated=true -2015/TimeFromYear.js spackled linguist-generated=true -2015/TimeWithinDay.js spackled linguist-generated=true -2015/ToBoolean.js spackled linguist-generated=true -2015/ToInt32.js spackled linguist-generated=true -2015/ToPropertyDescriptor.js spackled linguist-generated=true -2015/ToUint16.js spackled linguist-generated=true -2015/ToUint32.js spackled linguist-generated=true -2015/WeekDay.js spackled linguist-generated=true -2015/YearFromTime.js spackled linguist-generated=true -2015/abs.js spackled linguist-generated=true -2015/floor.js spackled linguist-generated=true -2015/modulo.js spackled linguist-generated=true -2015/msFromTime.js spackled linguist-generated=true -2016/AbstractEqualityComparison.js spackled linguist-generated=true -2016/AbstractRelationalComparison.js spackled linguist-generated=true -2016/AdvanceStringIndex.js spackled linguist-generated=true -2016/ArrayCreate.js spackled linguist-generated=true -2016/ArraySetLength.js spackled linguist-generated=true -2016/ArraySpeciesCreate.js spackled linguist-generated=true -2016/Call.js spackled linguist-generated=true -2016/CanonicalNumericIndexString.js spackled linguist-generated=true -2016/CompletePropertyDescriptor.js spackled linguist-generated=true -2016/CreateDataProperty.js spackled linguist-generated=true -2016/CreateDataPropertyOrThrow.js spackled linguist-generated=true -2016/CreateHTML.js spackled linguist-generated=true -2016/CreateIterResultObject.js spackled linguist-generated=true -2016/CreateListFromArrayLike.js spackled linguist-generated=true -2016/CreateMethodProperty.js spackled linguist-generated=true -2016/DateFromTime.js spackled linguist-generated=true -2016/Day.js spackled linguist-generated=true -2016/DayFromYear.js spackled linguist-generated=true -2016/DayWithinYear.js spackled linguist-generated=true -2016/DaysInYear.js spackled linguist-generated=true -2016/DefinePropertyOrThrow.js spackled linguist-generated=true -2016/DeletePropertyOrThrow.js spackled linguist-generated=true -2016/EnumerableOwnNames.js spackled linguist-generated=true -2016/FromPropertyDescriptor.js spackled linguist-generated=true -2016/Get.js spackled linguist-generated=true -2016/GetIterator.js spackled linguist-generated=true -2016/GetMethod.js spackled linguist-generated=true -2016/GetOwnPropertyKeys.js spackled linguist-generated=true -2016/GetPrototypeFromConstructor.js spackled linguist-generated=true -2016/GetSubstitution.js spackled linguist-generated=true -2016/GetV.js spackled linguist-generated=true -2016/HasOwnProperty.js spackled linguist-generated=true -2016/HasProperty.js spackled linguist-generated=true -2016/HourFromTime.js spackled linguist-generated=true -2016/InLeapYear.js spackled linguist-generated=true -2016/InstanceofOperator.js spackled linguist-generated=true -2016/Invoke.js spackled linguist-generated=true -2016/IsAccessorDescriptor.js spackled linguist-generated=true -2016/IsArray.js spackled linguist-generated=true -2016/IsCallable.js spackled linguist-generated=true -2016/IsConcatSpreadable.js spackled linguist-generated=true -2016/IsConstructor.js spackled linguist-generated=true -2016/IsDataDescriptor.js spackled linguist-generated=true -2016/IsExtensible.js spackled linguist-generated=true -2016/IsGenericDescriptor.js spackled linguist-generated=true -2016/IsInteger.js spackled linguist-generated=true -2016/IsPromise.js spackled linguist-generated=true -2016/IsPropertyDescriptor.js spackled linguist-generated=true -2016/IsPropertyKey.js spackled linguist-generated=true -2016/IsRegExp.js spackled linguist-generated=true -2016/IteratorClose.js spackled linguist-generated=true -2016/IteratorComplete.js spackled linguist-generated=true -2016/IteratorNext.js spackled linguist-generated=true -2016/IteratorStep.js spackled linguist-generated=true -2016/IteratorValue.js spackled linguist-generated=true -2016/MakeDate.js spackled linguist-generated=true -2016/MakeDay.js spackled linguist-generated=true -2016/MakeTime.js spackled linguist-generated=true -2016/MinFromTime.js spackled linguist-generated=true -2016/MonthFromTime.js spackled linguist-generated=true -2016/ObjectCreate.js spackled linguist-generated=true -2016/OrdinaryCreateFromConstructor.js spackled linguist-generated=true -2016/OrdinaryDefineOwnProperty.js spackled linguist-generated=true -2016/OrdinaryGetOwnProperty.js spackled linguist-generated=true -2016/OrdinaryHasInstance.js spackled linguist-generated=true -2016/OrdinaryHasProperty.js spackled linguist-generated=true -2016/QuoteJSONString.js spackled linguist-generated=true -2016/RegExpCreate.js spackled linguist-generated=true -2016/RegExpExec.js spackled linguist-generated=true -2016/RequireObjectCoercible.js spackled linguist-generated=true -2016/SameValue.js spackled linguist-generated=true -2016/SameValueZero.js spackled linguist-generated=true -2016/SecFromTime.js spackled linguist-generated=true -2016/Set.js spackled linguist-generated=true -2016/SetFunctionName.js spackled linguist-generated=true -2016/SetIntegrityLevel.js spackled linguist-generated=true -2016/SpeciesConstructor.js spackled linguist-generated=true -2016/SplitMatch.js spackled linguist-generated=true -2016/StrictEqualityComparison.js spackled linguist-generated=true -2016/StringCreate.js spackled linguist-generated=true -2016/SymbolDescriptiveString.js spackled linguist-generated=true -2016/TestIntegrityLevel.js spackled linguist-generated=true -2016/TimeClip.js spackled linguist-generated=true -2016/TimeFromYear.js spackled linguist-generated=true -2016/TimeWithinDay.js spackled linguist-generated=true -2016/ToBoolean.js spackled linguist-generated=true -2016/ToDateString.js spackled linguist-generated=true -2016/ToInt16.js spackled linguist-generated=true -2016/ToInt32.js spackled linguist-generated=true -2016/ToInt8.js spackled linguist-generated=true -2016/ToInteger.js spackled linguist-generated=true -2016/ToLength.js spackled linguist-generated=true -2016/ToNumber.js spackled linguist-generated=true -2016/ToObject.js spackled linguist-generated=true -2016/ToPrimitive.js spackled linguist-generated=true -2016/ToPropertyDescriptor.js spackled linguist-generated=true -2016/ToPropertyKey.js spackled linguist-generated=true -2016/ToString.js spackled linguist-generated=true -2016/ToUint16.js spackled linguist-generated=true -2016/ToUint32.js spackled linguist-generated=true -2016/ToUint8.js spackled linguist-generated=true -2016/ToUint8Clamp.js spackled linguist-generated=true -2016/Type.js spackled linguist-generated=true -2016/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true -2016/WeekDay.js spackled linguist-generated=true -2016/YearFromTime.js spackled linguist-generated=true -2016/abs.js spackled linguist-generated=true -2016/floor.js spackled linguist-generated=true -2016/modulo.js spackled linguist-generated=true -2016/msFromTime.js spackled linguist-generated=true -2016/thisBooleanValue.js spackled linguist-generated=true -2016/thisNumberValue.js spackled linguist-generated=true -2016/thisStringValue.js spackled linguist-generated=true -2016/thisTimeValue.js spackled linguist-generated=true -2017/AbstractEqualityComparison.js spackled linguist-generated=true -2017/AbstractRelationalComparison.js spackled linguist-generated=true -2017/AdvanceStringIndex.js spackled linguist-generated=true -2017/ArrayCreate.js spackled linguist-generated=true -2017/ArraySetLength.js spackled linguist-generated=true -2017/ArraySpeciesCreate.js spackled linguist-generated=true -2017/Call.js spackled linguist-generated=true -2017/CanonicalNumericIndexString.js spackled linguist-generated=true -2017/CompletePropertyDescriptor.js spackled linguist-generated=true -2017/CreateDataProperty.js spackled linguist-generated=true -2017/CreateDataPropertyOrThrow.js spackled linguist-generated=true -2017/CreateHTML.js spackled linguist-generated=true -2017/CreateIterResultObject.js spackled linguist-generated=true -2017/CreateListFromArrayLike.js spackled linguist-generated=true -2017/CreateMethodProperty.js spackled linguist-generated=true -2017/DateFromTime.js spackled linguist-generated=true -2017/Day.js spackled linguist-generated=true -2017/DayFromYear.js spackled linguist-generated=true -2017/DayWithinYear.js spackled linguist-generated=true -2017/DaysInYear.js spackled linguist-generated=true -2017/DefinePropertyOrThrow.js spackled linguist-generated=true -2017/DeletePropertyOrThrow.js spackled linguist-generated=true -2017/FromPropertyDescriptor.js spackled linguist-generated=true -2017/Get.js spackled linguist-generated=true -2017/GetIterator.js spackled linguist-generated=true -2017/GetMethod.js spackled linguist-generated=true -2017/GetOwnPropertyKeys.js spackled linguist-generated=true -2017/GetPrototypeFromConstructor.js spackled linguist-generated=true -2017/GetSubstitution.js spackled linguist-generated=true -2017/GetV.js spackled linguist-generated=true -2017/HasOwnProperty.js spackled linguist-generated=true -2017/HasProperty.js spackled linguist-generated=true -2017/HourFromTime.js spackled linguist-generated=true -2017/InLeapYear.js spackled linguist-generated=true -2017/InstanceofOperator.js spackled linguist-generated=true -2017/Invoke.js spackled linguist-generated=true -2017/IsAccessorDescriptor.js spackled linguist-generated=true -2017/IsArray.js spackled linguist-generated=true -2017/IsCallable.js spackled linguist-generated=true -2017/IsConcatSpreadable.js spackled linguist-generated=true -2017/IsConstructor.js spackled linguist-generated=true -2017/IsDataDescriptor.js spackled linguist-generated=true -2017/IsExtensible.js spackled linguist-generated=true -2017/IsGenericDescriptor.js spackled linguist-generated=true -2017/IsInteger.js spackled linguist-generated=true -2017/IsPromise.js spackled linguist-generated=true -2017/IsPropertyDescriptor.js spackled linguist-generated=true -2017/IsPropertyKey.js spackled linguist-generated=true -2017/IsRegExp.js spackled linguist-generated=true -2017/IteratorClose.js spackled linguist-generated=true -2017/IteratorComplete.js spackled linguist-generated=true -2017/IteratorNext.js spackled linguist-generated=true -2017/IteratorStep.js spackled linguist-generated=true -2017/IteratorValue.js spackled linguist-generated=true -2017/MakeDate.js spackled linguist-generated=true -2017/MakeDay.js spackled linguist-generated=true -2017/MakeTime.js spackled linguist-generated=true -2017/MinFromTime.js spackled linguist-generated=true -2017/MonthFromTime.js spackled linguist-generated=true -2017/ObjectCreate.js spackled linguist-generated=true -2017/OrdinaryCreateFromConstructor.js spackled linguist-generated=true -2017/OrdinaryDefineOwnProperty.js spackled linguist-generated=true -2017/OrdinaryGetOwnProperty.js spackled linguist-generated=true -2017/OrdinaryGetPrototypeOf.js spackled linguist-generated=true -2017/OrdinaryHasInstance.js spackled linguist-generated=true -2017/OrdinaryHasProperty.js spackled linguist-generated=true -2017/OrdinarySetPrototypeOf.js spackled linguist-generated=true -2017/QuoteJSONString.js spackled linguist-generated=true -2017/RegExpCreate.js spackled linguist-generated=true -2017/RegExpExec.js spackled linguist-generated=true -2017/RequireObjectCoercible.js spackled linguist-generated=true -2017/SameValue.js spackled linguist-generated=true -2017/SameValueNonNumber.js spackled linguist-generated=true -2017/SameValueZero.js spackled linguist-generated=true -2017/SecFromTime.js spackled linguist-generated=true -2017/Set.js spackled linguist-generated=true -2017/SetFunctionName.js spackled linguist-generated=true -2017/SetIntegrityLevel.js spackled linguist-generated=true -2017/SpeciesConstructor.js spackled linguist-generated=true -2017/SplitMatch.js spackled linguist-generated=true -2017/StrictEqualityComparison.js spackled linguist-generated=true -2017/StringCreate.js spackled linguist-generated=true -2017/SymbolDescriptiveString.js spackled linguist-generated=true -2017/TestIntegrityLevel.js spackled linguist-generated=true -2017/TimeClip.js spackled linguist-generated=true -2017/TimeFromYear.js spackled linguist-generated=true -2017/TimeWithinDay.js spackled linguist-generated=true -2017/ToBoolean.js spackled linguist-generated=true -2017/ToDateString.js spackled linguist-generated=true -2017/ToInt16.js spackled linguist-generated=true -2017/ToInt32.js spackled linguist-generated=true -2017/ToInt8.js spackled linguist-generated=true -2017/ToInteger.js spackled linguist-generated=true -2017/ToLength.js spackled linguist-generated=true -2017/ToNumber.js spackled linguist-generated=true -2017/ToObject.js spackled linguist-generated=true -2017/ToPrimitive.js spackled linguist-generated=true -2017/ToPropertyDescriptor.js spackled linguist-generated=true -2017/ToPropertyKey.js spackled linguist-generated=true -2017/ToString.js spackled linguist-generated=true -2017/ToUint16.js spackled linguist-generated=true -2017/ToUint32.js spackled linguist-generated=true -2017/ToUint8.js spackled linguist-generated=true -2017/ToUint8Clamp.js spackled linguist-generated=true -2017/Type.js spackled linguist-generated=true -2017/UTF16Decode.js spackled linguist-generated=true -2017/UTF16Encoding.js spackled linguist-generated=true -2017/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true -2017/WeekDay.js spackled linguist-generated=true -2017/YearFromTime.js spackled linguist-generated=true -2017/abs.js spackled linguist-generated=true -2017/floor.js spackled linguist-generated=true -2017/modulo.js spackled linguist-generated=true -2017/msFromTime.js spackled linguist-generated=true -2017/thisBooleanValue.js spackled linguist-generated=true -2017/thisNumberValue.js spackled linguist-generated=true -2017/thisStringValue.js spackled linguist-generated=true -2017/thisTimeValue.js spackled linguist-generated=true -2018/AbstractEqualityComparison.js spackled linguist-generated=true -2018/AbstractRelationalComparison.js spackled linguist-generated=true -2018/AdvanceStringIndex.js spackled linguist-generated=true -2018/ArrayCreate.js spackled linguist-generated=true -2018/ArraySetLength.js spackled linguist-generated=true -2018/ArraySpeciesCreate.js spackled linguist-generated=true -2018/Call.js spackled linguist-generated=true -2018/CanonicalNumericIndexString.js spackled linguist-generated=true -2018/CompletePropertyDescriptor.js spackled linguist-generated=true -2018/CreateDataProperty.js spackled linguist-generated=true -2018/CreateDataPropertyOrThrow.js spackled linguist-generated=true -2018/CreateHTML.js spackled linguist-generated=true -2018/CreateIterResultObject.js spackled linguist-generated=true -2018/CreateListFromArrayLike.js spackled linguist-generated=true -2018/CreateMethodProperty.js spackled linguist-generated=true -2018/DateFromTime.js spackled linguist-generated=true -2018/Day.js spackled linguist-generated=true -2018/DayFromYear.js spackled linguist-generated=true -2018/DayWithinYear.js spackled linguist-generated=true -2018/DaysInYear.js spackled linguist-generated=true -2018/DefinePropertyOrThrow.js spackled linguist-generated=true -2018/DeletePropertyOrThrow.js spackled linguist-generated=true -2018/FromPropertyDescriptor.js spackled linguist-generated=true -2018/Get.js spackled linguist-generated=true -2018/GetIterator.js spackled linguist-generated=true -2018/GetMethod.js spackled linguist-generated=true -2018/GetOwnPropertyKeys.js spackled linguist-generated=true -2018/GetPrototypeFromConstructor.js spackled linguist-generated=true -2018/GetV.js spackled linguist-generated=true -2018/HasOwnProperty.js spackled linguist-generated=true -2018/HasProperty.js spackled linguist-generated=true -2018/HourFromTime.js spackled linguist-generated=true -2018/InLeapYear.js spackled linguist-generated=true -2018/InstanceofOperator.js spackled linguist-generated=true -2018/Invoke.js spackled linguist-generated=true -2018/IsAccessorDescriptor.js spackled linguist-generated=true -2018/IsArray.js spackled linguist-generated=true -2018/IsCallable.js spackled linguist-generated=true -2018/IsConcatSpreadable.js spackled linguist-generated=true -2018/IsConstructor.js spackled linguist-generated=true -2018/IsDataDescriptor.js spackled linguist-generated=true -2018/IsExtensible.js spackled linguist-generated=true -2018/IsGenericDescriptor.js spackled linguist-generated=true -2018/IsInteger.js spackled linguist-generated=true -2018/IsPromise.js spackled linguist-generated=true -2018/IsPropertyKey.js spackled linguist-generated=true -2018/IsRegExp.js spackled linguist-generated=true -2018/IterableToList.js spackled linguist-generated=true -2018/IteratorClose.js spackled linguist-generated=true -2018/IteratorComplete.js spackled linguist-generated=true -2018/IteratorNext.js spackled linguist-generated=true -2018/IteratorStep.js spackled linguist-generated=true -2018/IteratorValue.js spackled linguist-generated=true -2018/MakeDate.js spackled linguist-generated=true -2018/MakeDay.js spackled linguist-generated=true -2018/MakeTime.js spackled linguist-generated=true -2018/MinFromTime.js spackled linguist-generated=true -2018/MonthFromTime.js spackled linguist-generated=true -2018/ObjectCreate.js spackled linguist-generated=true -2018/OrdinaryCreateFromConstructor.js spackled linguist-generated=true -2018/OrdinaryDefineOwnProperty.js spackled linguist-generated=true -2018/OrdinaryGetOwnProperty.js spackled linguist-generated=true -2018/OrdinaryGetPrototypeOf.js spackled linguist-generated=true -2018/OrdinaryHasInstance.js spackled linguist-generated=true -2018/OrdinaryHasProperty.js spackled linguist-generated=true -2018/OrdinarySetPrototypeOf.js spackled linguist-generated=true -2018/RegExpCreate.js spackled linguist-generated=true -2018/RegExpExec.js spackled linguist-generated=true -2018/RequireObjectCoercible.js spackled linguist-generated=true -2018/SameValue.js spackled linguist-generated=true -2018/SameValueNonNumber.js spackled linguist-generated=true -2018/SameValueZero.js spackled linguist-generated=true -2018/SecFromTime.js spackled linguist-generated=true -2018/Set.js spackled linguist-generated=true -2018/SetFunctionName.js spackled linguist-generated=true -2018/SetIntegrityLevel.js spackled linguist-generated=true -2018/SpeciesConstructor.js spackled linguist-generated=true -2018/SplitMatch.js spackled linguist-generated=true -2018/StrictEqualityComparison.js spackled linguist-generated=true -2018/StringCreate.js spackled linguist-generated=true -2018/StringGetOwnProperty.js spackled linguist-generated=true -2018/SymbolDescriptiveString.js spackled linguist-generated=true -2018/TestIntegrityLevel.js spackled linguist-generated=true -2018/TimeClip.js spackled linguist-generated=true -2018/TimeFromYear.js spackled linguist-generated=true -2018/TimeWithinDay.js spackled linguist-generated=true -2018/ToBoolean.js spackled linguist-generated=true -2018/ToDateString.js spackled linguist-generated=true -2018/ToIndex.js spackled linguist-generated=true -2018/ToInt16.js spackled linguist-generated=true -2018/ToInt32.js spackled linguist-generated=true -2018/ToInt8.js spackled linguist-generated=true -2018/ToInteger.js spackled linguist-generated=true -2018/ToLength.js spackled linguist-generated=true -2018/ToNumber.js spackled linguist-generated=true -2018/ToObject.js spackled linguist-generated=true -2018/ToPrimitive.js spackled linguist-generated=true -2018/ToPropertyDescriptor.js spackled linguist-generated=true -2018/ToPropertyKey.js spackled linguist-generated=true -2018/ToString.js spackled linguist-generated=true -2018/ToUint16.js spackled linguist-generated=true -2018/ToUint32.js spackled linguist-generated=true -2018/ToUint8.js spackled linguist-generated=true -2018/ToUint8Clamp.js spackled linguist-generated=true -2018/Type.js spackled linguist-generated=true -2018/UTF16Decode.js spackled linguist-generated=true -2018/UTF16Encoding.js spackled linguist-generated=true -2018/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true -2018/WeekDay.js spackled linguist-generated=true -2018/YearFromTime.js spackled linguist-generated=true -2018/abs.js spackled linguist-generated=true -2018/floor.js spackled linguist-generated=true -2018/modulo.js spackled linguist-generated=true -2018/msFromTime.js spackled linguist-generated=true -2018/thisBooleanValue.js spackled linguist-generated=true -2018/thisNumberValue.js spackled linguist-generated=true -2018/thisStringValue.js spackled linguist-generated=true -2018/thisTimeValue.js spackled linguist-generated=true -2019/AbstractEqualityComparison.js spackled linguist-generated=true -2019/AbstractRelationalComparison.js spackled linguist-generated=true -2019/AdvanceStringIndex.js spackled linguist-generated=true -2019/ArrayCreate.js spackled linguist-generated=true -2019/ArraySetLength.js spackled linguist-generated=true -2019/ArraySpeciesCreate.js spackled linguist-generated=true -2019/Call.js spackled linguist-generated=true -2019/CanonicalNumericIndexString.js spackled linguist-generated=true -2019/CompletePropertyDescriptor.js spackled linguist-generated=true -2019/CopyDataProperties.js spackled linguist-generated=true -2019/CreateDataProperty.js spackled linguist-generated=true -2019/CreateDataPropertyOrThrow.js spackled linguist-generated=true -2019/CreateHTML.js spackled linguist-generated=true -2019/CreateIterResultObject.js spackled linguist-generated=true -2019/CreateListFromArrayLike.js spackled linguist-generated=true -2019/CreateMethodProperty.js spackled linguist-generated=true -2019/DateFromTime.js spackled linguist-generated=true -2019/DateString.js spackled linguist-generated=true -2019/Day.js spackled linguist-generated=true -2019/DayFromYear.js spackled linguist-generated=true -2019/DayWithinYear.js spackled linguist-generated=true -2019/DaysInYear.js spackled linguist-generated=true -2019/DefinePropertyOrThrow.js spackled linguist-generated=true -2019/DeletePropertyOrThrow.js spackled linguist-generated=true -2019/EnumerableOwnPropertyNames.js spackled linguist-generated=true -2019/FromPropertyDescriptor.js spackled linguist-generated=true -2019/Get.js spackled linguist-generated=true -2019/GetIterator.js spackled linguist-generated=true -2019/GetMethod.js spackled linguist-generated=true -2019/GetOwnPropertyKeys.js spackled linguist-generated=true -2019/GetPrototypeFromConstructor.js spackled linguist-generated=true -2019/GetSubstitution.js spackled linguist-generated=true -2019/GetV.js spackled linguist-generated=true -2019/HasOwnProperty.js spackled linguist-generated=true -2019/HasProperty.js spackled linguist-generated=true -2019/HourFromTime.js spackled linguist-generated=true -2019/InLeapYear.js spackled linguist-generated=true -2019/InstanceofOperator.js spackled linguist-generated=true -2019/Invoke.js spackled linguist-generated=true -2019/IsAccessorDescriptor.js spackled linguist-generated=true -2019/IsArray.js spackled linguist-generated=true -2019/IsCallable.js spackled linguist-generated=true -2019/IsConcatSpreadable.js spackled linguist-generated=true -2019/IsConstructor.js spackled linguist-generated=true -2019/IsDataDescriptor.js spackled linguist-generated=true -2019/IsExtensible.js spackled linguist-generated=true -2019/IsGenericDescriptor.js spackled linguist-generated=true -2019/IsInteger.js spackled linguist-generated=true -2019/IsPromise.js spackled linguist-generated=true -2019/IsPropertyKey.js spackled linguist-generated=true -2019/IsRegExp.js spackled linguist-generated=true -2019/IsStringPrefix.js spackled linguist-generated=true -2019/IterableToList.js spackled linguist-generated=true -2019/IteratorClose.js spackled linguist-generated=true -2019/IteratorComplete.js spackled linguist-generated=true -2019/IteratorNext.js spackled linguist-generated=true -2019/IteratorStep.js spackled linguist-generated=true -2019/IteratorValue.js spackled linguist-generated=true -2019/MakeDate.js spackled linguist-generated=true -2019/MakeDay.js spackled linguist-generated=true -2019/MakeTime.js spackled linguist-generated=true -2019/MinFromTime.js spackled linguist-generated=true -2019/MonthFromTime.js spackled linguist-generated=true -2019/NumberToString.js spackled linguist-generated=true -2019/ObjectCreate.js spackled linguist-generated=true -2019/OrdinaryCreateFromConstructor.js spackled linguist-generated=true -2019/OrdinaryDefineOwnProperty.js spackled linguist-generated=true -2019/OrdinaryGetOwnProperty.js spackled linguist-generated=true -2019/OrdinaryGetPrototypeOf.js spackled linguist-generated=true -2019/OrdinaryHasInstance.js spackled linguist-generated=true -2019/OrdinaryHasProperty.js spackled linguist-generated=true -2019/OrdinarySetPrototypeOf.js spackled linguist-generated=true -2019/PromiseResolve.js spackled linguist-generated=true -2019/RegExpCreate.js spackled linguist-generated=true -2019/RegExpExec.js spackled linguist-generated=true -2019/RequireObjectCoercible.js spackled linguist-generated=true -2019/SameValue.js spackled linguist-generated=true -2019/SameValueNonNumber.js spackled linguist-generated=true -2019/SameValueZero.js spackled linguist-generated=true -2019/SecFromTime.js spackled linguist-generated=true -2019/Set.js spackled linguist-generated=true -2019/SetFunctionLength.js spackled linguist-generated=true -2019/SetFunctionName.js spackled linguist-generated=true -2019/SetIntegrityLevel.js spackled linguist-generated=true -2019/SpeciesConstructor.js spackled linguist-generated=true -2019/SplitMatch.js spackled linguist-generated=true -2019/StrictEqualityComparison.js spackled linguist-generated=true -2019/StringCreate.js spackled linguist-generated=true -2019/StringGetOwnProperty.js spackled linguist-generated=true -2019/SymbolDescriptiveString.js spackled linguist-generated=true -2019/TestIntegrityLevel.js spackled linguist-generated=true -2019/TimeClip.js spackled linguist-generated=true -2019/TimeFromYear.js spackled linguist-generated=true -2019/TimeString.js spackled linguist-generated=true -2019/TimeWithinDay.js spackled linguist-generated=true -2019/ToBoolean.js spackled linguist-generated=true -2019/ToDateString.js spackled linguist-generated=true -2019/ToIndex.js spackled linguist-generated=true -2019/ToInt16.js spackled linguist-generated=true -2019/ToInt32.js spackled linguist-generated=true -2019/ToInt8.js spackled linguist-generated=true -2019/ToInteger.js spackled linguist-generated=true -2019/ToLength.js spackled linguist-generated=true -2019/ToNumber.js spackled linguist-generated=true -2019/ToObject.js spackled linguist-generated=true -2019/ToPrimitive.js spackled linguist-generated=true -2019/ToPropertyDescriptor.js spackled linguist-generated=true -2019/ToPropertyKey.js spackled linguist-generated=true -2019/ToString.js spackled linguist-generated=true -2019/ToUint16.js spackled linguist-generated=true -2019/ToUint32.js spackled linguist-generated=true -2019/ToUint8.js spackled linguist-generated=true -2019/ToUint8Clamp.js spackled linguist-generated=true -2019/Type.js spackled linguist-generated=true -2019/UTF16Decode.js spackled linguist-generated=true -2019/UTF16Encoding.js spackled linguist-generated=true -2019/UnicodeEscape.js spackled linguist-generated=true -2019/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true -2019/WeekDay.js spackled linguist-generated=true -2019/YearFromTime.js spackled linguist-generated=true -2019/abs.js spackled linguist-generated=true -2019/floor.js spackled linguist-generated=true -2019/modulo.js spackled linguist-generated=true -2019/msFromTime.js spackled linguist-generated=true -2019/thisBooleanValue.js spackled linguist-generated=true -2019/thisNumberValue.js spackled linguist-generated=true -2019/thisStringValue.js spackled linguist-generated=true -2019/thisSymbolValue.js spackled linguist-generated=true -2020/AbstractEqualityComparison.js spackled linguist-generated=true -2020/AbstractRelationalComparison.js spackled linguist-generated=true -2020/AddEntriesFromIterable.js spackled linguist-generated=true -2020/ArrayCreate.js spackled linguist-generated=true -2020/ArraySetLength.js spackled linguist-generated=true -2020/ArraySpeciesCreate.js spackled linguist-generated=true -2020/Call.js spackled linguist-generated=true -2020/CanonicalNumericIndexString.js spackled linguist-generated=true -2020/CompletePropertyDescriptor.js spackled linguist-generated=true -2020/CreateDataProperty.js spackled linguist-generated=true -2020/CreateDataPropertyOrThrow.js spackled linguist-generated=true -2020/CreateHTML.js spackled linguist-generated=true -2020/CreateIterResultObject.js spackled linguist-generated=true -2020/CreateMethodProperty.js spackled linguist-generated=true -2020/DateFromTime.js spackled linguist-generated=true -2020/DateString.js spackled linguist-generated=true -2020/Day.js spackled linguist-generated=true -2020/DayFromYear.js spackled linguist-generated=true -2020/DayWithinYear.js spackled linguist-generated=true -2020/DaysInYear.js spackled linguist-generated=true -2020/DefinePropertyOrThrow.js spackled linguist-generated=true -2020/DeletePropertyOrThrow.js spackled linguist-generated=true -2020/EnumerableOwnPropertyNames.js spackled linguist-generated=true -2020/FromPropertyDescriptor.js spackled linguist-generated=true -2020/Get.js spackled linguist-generated=true -2020/GetMethod.js spackled linguist-generated=true -2020/GetOwnPropertyKeys.js spackled linguist-generated=true -2020/GetPrototypeFromConstructor.js spackled linguist-generated=true -2020/GetSubstitution.js spackled linguist-generated=true -2020/GetV.js spackled linguist-generated=true -2020/HasOwnProperty.js spackled linguist-generated=true -2020/HasProperty.js spackled linguist-generated=true -2020/HourFromTime.js spackled linguist-generated=true -2020/InLeapYear.js spackled linguist-generated=true -2020/InstanceofOperator.js spackled linguist-generated=true -2020/Invoke.js spackled linguist-generated=true -2020/IsAccessorDescriptor.js spackled linguist-generated=true -2020/IsArray.js spackled linguist-generated=true -2020/IsCallable.js spackled linguist-generated=true -2020/IsConcatSpreadable.js spackled linguist-generated=true -2020/IsConstructor.js spackled linguist-generated=true -2020/IsDataDescriptor.js spackled linguist-generated=true -2020/IsExtensible.js spackled linguist-generated=true -2020/IsGenericDescriptor.js spackled linguist-generated=true -2020/IsInteger.js spackled linguist-generated=true -2020/IsPromise.js spackled linguist-generated=true -2020/IsPropertyKey.js spackled linguist-generated=true -2020/IsRegExp.js spackled linguist-generated=true -2020/IsStringPrefix.js spackled linguist-generated=true -2020/IteratorClose.js spackled linguist-generated=true -2020/IteratorComplete.js spackled linguist-generated=true -2020/IteratorNext.js spackled linguist-generated=true -2020/IteratorStep.js spackled linguist-generated=true -2020/IteratorValue.js spackled linguist-generated=true -2020/MakeDate.js spackled linguist-generated=true -2020/MakeDay.js spackled linguist-generated=true -2020/MakeTime.js spackled linguist-generated=true -2020/MinFromTime.js spackled linguist-generated=true -2020/MonthFromTime.js spackled linguist-generated=true -2020/OrdinaryDefineOwnProperty.js spackled linguist-generated=true -2020/OrdinaryGetOwnProperty.js spackled linguist-generated=true -2020/OrdinaryGetPrototypeOf.js spackled linguist-generated=true -2020/OrdinaryHasInstance.js spackled linguist-generated=true -2020/OrdinaryHasProperty.js spackled linguist-generated=true -2020/OrdinarySetPrototypeOf.js spackled linguist-generated=true -2020/PromiseResolve.js spackled linguist-generated=true -2020/RegExpCreate.js spackled linguist-generated=true -2020/RegExpExec.js spackled linguist-generated=true -2020/RequireObjectCoercible.js spackled linguist-generated=true -2020/SameValue.js spackled linguist-generated=true -2020/SameValueZero.js spackled linguist-generated=true -2020/SecFromTime.js spackled linguist-generated=true -2020/Set.js spackled linguist-generated=true -2020/SetFunctionName.js spackled linguist-generated=true -2020/SetIntegrityLevel.js spackled linguist-generated=true -2020/SpeciesConstructor.js spackled linguist-generated=true -2020/SplitMatch.js spackled linguist-generated=true -2020/StrictEqualityComparison.js spackled linguist-generated=true -2020/StringCreate.js spackled linguist-generated=true -2020/StringGetOwnProperty.js spackled linguist-generated=true -2020/SymbolDescriptiveString.js spackled linguist-generated=true -2020/TestIntegrityLevel.js spackled linguist-generated=true -2020/TimeClip.js spackled linguist-generated=true -2020/TimeFromYear.js spackled linguist-generated=true -2020/TimeString.js spackled linguist-generated=true -2020/TimeWithinDay.js spackled linguist-generated=true -2020/ToBoolean.js spackled linguist-generated=true -2020/ToDateString.js spackled linguist-generated=true -2020/ToInt16.js spackled linguist-generated=true -2020/ToInt32.js spackled linguist-generated=true -2020/ToInt8.js spackled linguist-generated=true -2020/ToLength.js spackled linguist-generated=true -2020/ToObject.js spackled linguist-generated=true -2020/ToPrimitive.js spackled linguist-generated=true -2020/ToPropertyDescriptor.js spackled linguist-generated=true -2020/ToPropertyKey.js spackled linguist-generated=true -2020/ToString.js spackled linguist-generated=true -2020/ToUint16.js spackled linguist-generated=true -2020/ToUint32.js spackled linguist-generated=true -2020/ToUint8.js spackled linguist-generated=true -2020/ToUint8Clamp.js spackled linguist-generated=true -2020/TrimString.js spackled linguist-generated=true -2020/UTF16Encoding.js spackled linguist-generated=true -2020/ValidateAndApplyPropertyDescriptor.js spackled linguist-generated=true -2020/WeekDay.js spackled linguist-generated=true -2020/YearFromTime.js spackled linguist-generated=true -2020/abs.js spackled linguist-generated=true -2020/floor.js spackled linguist-generated=true -2020/modulo.js spackled linguist-generated=true -2020/msFromTime.js spackled linguist-generated=true -2020/thisBooleanValue.js spackled linguist-generated=true -2020/thisNumberValue.js spackled linguist-generated=true -2020/thisStringValue.js spackled linguist-generated=true -2020/thisSymbolValue.js spackled linguist-generated=true -2020/thisTimeValue.js spackled linguist-generated=true \ No newline at end of file diff --git a/docs/snippets/node_modules/es-abstract/2015/CharacterRange.js b/docs/snippets/node_modules/es-abstract/2015/CharacterRange.js new file mode 100644 index 00000000..70e4b523 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2015/CharacterRange.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $charCodeAt = callBound('%String.prototype.charCodeAt%'); +var $push = callBound('%Array.prototype.push%'); + +module.exports = function CharacterRange(A, B) { + if (A.length !== 1 || B.length !== 1) { + throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); + } + + var a = A[0]; + var b = B[0]; + + var i = $charCodeAt(a, 0); + var j = $charCodeAt(b, 0); + + if (!(i <= j)) { + throw new $TypeError('Assertion failed: i is not <= j'); + } + + var arr = []; + for (var k = i; k <= j; k += 1) { + $push(arr, $fromCharCode(k)); + } + return arr; +}; diff --git a/docs/snippets/node_modules/es-abstract/2015/IsCompatiblePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2015/IsCompatiblePropertyDescriptor.js new file mode 100644 index 00000000..8bdaf3eb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2015/IsCompatiblePropertyDescriptor.js @@ -0,0 +1,9 @@ +'use strict'; + +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor + +module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { + return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2015/Set.js b/docs/snippets/node_modules/es-abstract/2015/Set.js index ea49e813..09714988 100644 --- a/docs/snippets/node_modules/es-abstract/2015/Set.js +++ b/docs/snippets/node_modules/es-abstract/2015/Set.js @@ -36,12 +36,12 @@ module.exports = function Set(O, P, V, Throw) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; - } else { - try { - O[P] = V; // eslint-disable-line no-param-reassign - return noThrowOnStrictViolation ? SameValue(O[P], V) : true; - } catch (e) { - return false; - } } + try { + O[P] = V; // eslint-disable-line no-param-reassign + return noThrowOnStrictViolation ? SameValue(O[P], V) : true; + } catch (e) { + return false; + } + }; diff --git a/docs/snippets/node_modules/es-abstract/2015/SetFunctionName.js b/docs/snippets/node_modules/es-abstract/2015/SetFunctionName.js index f59cb7b9..03ec2227 100644 --- a/docs/snippets/node_modules/es-abstract/2015/SetFunctionName.js +++ b/docs/snippets/node_modules/es-abstract/2015/SetFunctionName.js @@ -6,7 +6,7 @@ var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); -var getSymbolDescription = require('../helpers/getSymbolDescription'); +var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); diff --git a/docs/snippets/node_modules/es-abstract/2015/ToNumber.js b/docs/snippets/node_modules/es-abstract/2015/ToNumber.js index e776bb2b..197b5c57 100644 --- a/docs/snippets/node_modules/es-abstract/2015/ToNumber.js +++ b/docs/snippets/node_modules/es-abstract/2015/ToNumber.js @@ -48,12 +48,12 @@ module.exports = function ToNumber(argument) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; - } else { - var trimmed = $trim(value); - if (trimmed !== value) { - return ToNumber(trimmed); - } } + var trimmed = $trim(value); + if (trimmed !== value) { + return ToNumber(trimmed); + } + } return $Number(value); }; diff --git a/docs/snippets/node_modules/es-abstract/2016/CharacterRange.js b/docs/snippets/node_modules/es-abstract/2016/CharacterRange.js new file mode 100644 index 00000000..70e4b523 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2016/CharacterRange.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $charCodeAt = callBound('%String.prototype.charCodeAt%'); +var $push = callBound('%Array.prototype.push%'); + +module.exports = function CharacterRange(A, B) { + if (A.length !== 1 || B.length !== 1) { + throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); + } + + var a = A[0]; + var b = B[0]; + + var i = $charCodeAt(a, 0); + var j = $charCodeAt(b, 0); + + if (!(i <= j)) { + throw new $TypeError('Assertion failed: i is not <= j'); + } + + var arr = []; + for (var k = i; k <= j; k += 1) { + $push(arr, $fromCharCode(k)); + } + return arr; +}; diff --git a/docs/snippets/node_modules/es-abstract/2016/IsCompatiblePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2016/IsCompatiblePropertyDescriptor.js new file mode 100644 index 00000000..8bdaf3eb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2016/IsCompatiblePropertyDescriptor.js @@ -0,0 +1,9 @@ +'use strict'; + +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor + +module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { + return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2016/Set.js b/docs/snippets/node_modules/es-abstract/2016/Set.js index ea49e813..09714988 100644 --- a/docs/snippets/node_modules/es-abstract/2016/Set.js +++ b/docs/snippets/node_modules/es-abstract/2016/Set.js @@ -36,12 +36,12 @@ module.exports = function Set(O, P, V, Throw) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; - } else { - try { - O[P] = V; // eslint-disable-line no-param-reassign - return noThrowOnStrictViolation ? SameValue(O[P], V) : true; - } catch (e) { - return false; - } } + try { + O[P] = V; // eslint-disable-line no-param-reassign + return noThrowOnStrictViolation ? SameValue(O[P], V) : true; + } catch (e) { + return false; + } + }; diff --git a/docs/snippets/node_modules/es-abstract/2016/SetFunctionName.js b/docs/snippets/node_modules/es-abstract/2016/SetFunctionName.js index f59cb7b9..03ec2227 100644 --- a/docs/snippets/node_modules/es-abstract/2016/SetFunctionName.js +++ b/docs/snippets/node_modules/es-abstract/2016/SetFunctionName.js @@ -6,7 +6,7 @@ var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); -var getSymbolDescription = require('../helpers/getSymbolDescription'); +var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); diff --git a/docs/snippets/node_modules/es-abstract/2016/ToNumber.js b/docs/snippets/node_modules/es-abstract/2016/ToNumber.js index e776bb2b..197b5c57 100644 --- a/docs/snippets/node_modules/es-abstract/2016/ToNumber.js +++ b/docs/snippets/node_modules/es-abstract/2016/ToNumber.js @@ -48,12 +48,12 @@ module.exports = function ToNumber(argument) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; - } else { - var trimmed = $trim(value); - if (trimmed !== value) { - return ToNumber(trimmed); - } } + var trimmed = $trim(value); + if (trimmed !== value) { + return ToNumber(trimmed); + } + } return $Number(value); }; diff --git a/docs/snippets/node_modules/es-abstract/2017/CharacterRange.js b/docs/snippets/node_modules/es-abstract/2017/CharacterRange.js new file mode 100644 index 00000000..70e4b523 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2017/CharacterRange.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $charCodeAt = callBound('%String.prototype.charCodeAt%'); +var $push = callBound('%Array.prototype.push%'); + +module.exports = function CharacterRange(A, B) { + if (A.length !== 1 || B.length !== 1) { + throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); + } + + var a = A[0]; + var b = B[0]; + + var i = $charCodeAt(a, 0); + var j = $charCodeAt(b, 0); + + if (!(i <= j)) { + throw new $TypeError('Assertion failed: i is not <= j'); + } + + var arr = []; + for (var k = i; k <= j; k += 1) { + $push(arr, $fromCharCode(k)); + } + return arr; +}; diff --git a/docs/snippets/node_modules/es-abstract/2017/IsCompatiblePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2017/IsCompatiblePropertyDescriptor.js new file mode 100644 index 00000000..8bdaf3eb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2017/IsCompatiblePropertyDescriptor.js @@ -0,0 +1,9 @@ +'use strict'; + +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor + +module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { + return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2017/IsSharedArrayBuffer.js b/docs/snippets/node_modules/es-abstract/2017/IsSharedArrayBuffer.js new file mode 100644 index 00000000..8e96e33f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2017/IsSharedArrayBuffer.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('./Type'); + +var isSharedArrayBuffer = require('is-shared-array-buffer'); + +// https://262.ecma-international.org/8.0/#sec-issharedarraybuffer + +module.exports = function IsSharedArrayBuffer(obj) { + if (Type(obj) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + return isSharedArrayBuffer(obj); +}; diff --git a/docs/snippets/node_modules/es-abstract/2017/OrdinaryToPrimitive.js b/docs/snippets/node_modules/es-abstract/2017/OrdinaryToPrimitive.js new file mode 100644 index 00000000..e1dbe142 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2017/OrdinaryToPrimitive.js @@ -0,0 +1,38 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +var inspect = require('object-inspect'); + +// https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive + +module.exports = function OrdinaryToPrimitive(O, hint) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { + throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); + } + + var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; + + for (var i = 0; i < methodNames.length; i += 1) { + var name = methodNames[i]; + var method = Get(O, name); + if (IsCallable(method)) { + var result = Call(method, O); + if (Type(result) !== 'Object') { + return result; + } + } + } + + throw new $TypeError('No primitive value for ' + inspect(O)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2017/Set.js b/docs/snippets/node_modules/es-abstract/2017/Set.js index ea49e813..09714988 100644 --- a/docs/snippets/node_modules/es-abstract/2017/Set.js +++ b/docs/snippets/node_modules/es-abstract/2017/Set.js @@ -36,12 +36,12 @@ module.exports = function Set(O, P, V, Throw) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; - } else { - try { - O[P] = V; // eslint-disable-line no-param-reassign - return noThrowOnStrictViolation ? SameValue(O[P], V) : true; - } catch (e) { - return false; - } } + try { + O[P] = V; // eslint-disable-line no-param-reassign + return noThrowOnStrictViolation ? SameValue(O[P], V) : true; + } catch (e) { + return false; + } + }; diff --git a/docs/snippets/node_modules/es-abstract/2017/SetFunctionName.js b/docs/snippets/node_modules/es-abstract/2017/SetFunctionName.js index f59cb7b9..03ec2227 100644 --- a/docs/snippets/node_modules/es-abstract/2017/SetFunctionName.js +++ b/docs/snippets/node_modules/es-abstract/2017/SetFunctionName.js @@ -6,7 +6,7 @@ var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); -var getSymbolDescription = require('../helpers/getSymbolDescription'); +var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); diff --git a/docs/snippets/node_modules/es-abstract/2017/ToNumber.js b/docs/snippets/node_modules/es-abstract/2017/ToNumber.js index e776bb2b..197b5c57 100644 --- a/docs/snippets/node_modules/es-abstract/2017/ToNumber.js +++ b/docs/snippets/node_modules/es-abstract/2017/ToNumber.js @@ -48,12 +48,12 @@ module.exports = function ToNumber(argument) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; - } else { - var trimmed = $trim(value); - if (trimmed !== value) { - return ToNumber(trimmed); - } } + var trimmed = $trim(value); + if (trimmed !== value) { + return ToNumber(trimmed); + } + } return $Number(value); }; diff --git a/docs/snippets/node_modules/es-abstract/2018/AbstractRelationalComparison.js b/docs/snippets/node_modules/es-abstract/2018/AbstractRelationalComparison.js index 0dfed5ff..7c6472f5 100644 --- a/docs/snippets/node_modules/es-abstract/2018/AbstractRelationalComparison.js +++ b/docs/snippets/node_modules/es-abstract/2018/AbstractRelationalComparison.js @@ -7,15 +7,14 @@ var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); -var isPrefixOf = require('../helpers/isPrefixOf'); +var IsStringPrefix = require('./IsStringPrefix'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); -// https://262.ecma-international.org/5.1/#sec-11.8.5 +// https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison -// eslint-disable-next-line max-statements module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); @@ -29,35 +28,34 @@ module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } - var bothStrings = Type(px) === 'String' && Type(py) === 'String'; - if (!bothStrings) { - var nx = ToNumber(px); - var ny = ToNumber(py); - if ($isNaN(nx) || $isNaN(ny)) { - return undefined; - } - if ($isFinite(nx) && $isFinite(ny) && nx === ny) { - return false; - } - if (nx === Infinity) { - return false; - } - if (ny === Infinity) { - return true; - } - if (ny === -Infinity) { + if (Type(px) === 'String' && Type(py) === 'String') { + if (IsStringPrefix(py, px)) { return false; } - if (nx === -Infinity) { + if (IsStringPrefix(px, py)) { return true; } - return nx < ny; // by now, these are both nonzero, finite, and not equal + return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f + } + var nx = ToNumber(px); + var ny = ToNumber(py); + if ($isNaN(nx) || $isNaN(ny)) { + return undefined; + } + if ($isFinite(nx) && $isFinite(ny) && nx === ny) { + return false; + } + if (nx === Infinity) { + return false; + } + if (ny === Infinity) { + return true; } - if (isPrefixOf(py, px)) { + if (ny === -Infinity) { return false; } - if (isPrefixOf(px, py)) { + if (nx === -Infinity) { return true; } - return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f + return nx < ny; // by now, these are both nonzero, finite, and not equal }; diff --git a/docs/snippets/node_modules/es-abstract/2018/CharacterRange.js b/docs/snippets/node_modules/es-abstract/2018/CharacterRange.js new file mode 100644 index 00000000..70e4b523 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2018/CharacterRange.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $charCodeAt = callBound('%String.prototype.charCodeAt%'); +var $push = callBound('%Array.prototype.push%'); + +module.exports = function CharacterRange(A, B) { + if (A.length !== 1 || B.length !== 1) { + throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); + } + + var a = A[0]; + var b = B[0]; + + var i = $charCodeAt(a, 0); + var j = $charCodeAt(b, 0); + + if (!(i <= j)) { + throw new $TypeError('Assertion failed: i is not <= j'); + } + + var arr = []; + for (var k = i; k <= j; k += 1) { + $push(arr, $fromCharCode(k)); + } + return arr; +}; diff --git a/docs/snippets/node_modules/es-abstract/2018/IsCompatiblePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2018/IsCompatiblePropertyDescriptor.js new file mode 100644 index 00000000..8bdaf3eb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2018/IsCompatiblePropertyDescriptor.js @@ -0,0 +1,9 @@ +'use strict'; + +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor + +module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { + return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2018/IsSharedArrayBuffer.js b/docs/snippets/node_modules/es-abstract/2018/IsSharedArrayBuffer.js new file mode 100644 index 00000000..8e96e33f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2018/IsSharedArrayBuffer.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('./Type'); + +var isSharedArrayBuffer = require('is-shared-array-buffer'); + +// https://262.ecma-international.org/8.0/#sec-issharedarraybuffer + +module.exports = function IsSharedArrayBuffer(obj) { + if (Type(obj) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + return isSharedArrayBuffer(obj); +}; diff --git a/docs/snippets/node_modules/es-abstract/2018/OrdinaryToPrimitive.js b/docs/snippets/node_modules/es-abstract/2018/OrdinaryToPrimitive.js new file mode 100644 index 00000000..e1dbe142 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2018/OrdinaryToPrimitive.js @@ -0,0 +1,38 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +var inspect = require('object-inspect'); + +// https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive + +module.exports = function OrdinaryToPrimitive(O, hint) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { + throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); + } + + var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; + + for (var i = 0; i < methodNames.length; i += 1) { + var name = methodNames[i]; + var method = Get(O, name); + if (IsCallable(method)) { + var result = Call(method, O); + if (Type(result) !== 'Object') { + return result; + } + } + } + + throw new $TypeError('No primitive value for ' + inspect(O)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2018/Set.js b/docs/snippets/node_modules/es-abstract/2018/Set.js index ea49e813..09714988 100644 --- a/docs/snippets/node_modules/es-abstract/2018/Set.js +++ b/docs/snippets/node_modules/es-abstract/2018/Set.js @@ -36,12 +36,12 @@ module.exports = function Set(O, P, V, Throw) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; - } else { - try { - O[P] = V; // eslint-disable-line no-param-reassign - return noThrowOnStrictViolation ? SameValue(O[P], V) : true; - } catch (e) { - return false; - } } + try { + O[P] = V; // eslint-disable-line no-param-reassign + return noThrowOnStrictViolation ? SameValue(O[P], V) : true; + } catch (e) { + return false; + } + }; diff --git a/docs/snippets/node_modules/es-abstract/2018/SetFunctionName.js b/docs/snippets/node_modules/es-abstract/2018/SetFunctionName.js index f59cb7b9..03ec2227 100644 --- a/docs/snippets/node_modules/es-abstract/2018/SetFunctionName.js +++ b/docs/snippets/node_modules/es-abstract/2018/SetFunctionName.js @@ -6,7 +6,7 @@ var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); -var getSymbolDescription = require('../helpers/getSymbolDescription'); +var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); diff --git a/docs/snippets/node_modules/es-abstract/2018/ToNumber.js b/docs/snippets/node_modules/es-abstract/2018/ToNumber.js index e776bb2b..197b5c57 100644 --- a/docs/snippets/node_modules/es-abstract/2018/ToNumber.js +++ b/docs/snippets/node_modules/es-abstract/2018/ToNumber.js @@ -48,12 +48,12 @@ module.exports = function ToNumber(argument) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; - } else { - var trimmed = $trim(value); - if (trimmed !== value) { - return ToNumber(trimmed); - } } + var trimmed = $trim(value); + if (trimmed !== value) { + return ToNumber(trimmed); + } + } return $Number(value); }; diff --git a/docs/snippets/node_modules/es-abstract/2019/AbstractRelationalComparison.js b/docs/snippets/node_modules/es-abstract/2019/AbstractRelationalComparison.js index 0dfed5ff..7c6472f5 100644 --- a/docs/snippets/node_modules/es-abstract/2019/AbstractRelationalComparison.js +++ b/docs/snippets/node_modules/es-abstract/2019/AbstractRelationalComparison.js @@ -7,15 +7,14 @@ var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); var $isFinite = require('../helpers/isFinite'); -var isPrefixOf = require('../helpers/isPrefixOf'); +var IsStringPrefix = require('./IsStringPrefix'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); -// https://262.ecma-international.org/5.1/#sec-11.8.5 +// https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison -// eslint-disable-next-line max-statements module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); @@ -29,35 +28,34 @@ module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } - var bothStrings = Type(px) === 'String' && Type(py) === 'String'; - if (!bothStrings) { - var nx = ToNumber(px); - var ny = ToNumber(py); - if ($isNaN(nx) || $isNaN(ny)) { - return undefined; - } - if ($isFinite(nx) && $isFinite(ny) && nx === ny) { - return false; - } - if (nx === Infinity) { - return false; - } - if (ny === Infinity) { - return true; - } - if (ny === -Infinity) { + if (Type(px) === 'String' && Type(py) === 'String') { + if (IsStringPrefix(py, px)) { return false; } - if (nx === -Infinity) { + if (IsStringPrefix(px, py)) { return true; } - return nx < ny; // by now, these are both nonzero, finite, and not equal + return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f + } + var nx = ToNumber(px); + var ny = ToNumber(py); + if ($isNaN(nx) || $isNaN(ny)) { + return undefined; + } + if ($isFinite(nx) && $isFinite(ny) && nx === ny) { + return false; + } + if (nx === Infinity) { + return false; + } + if (ny === Infinity) { + return true; } - if (isPrefixOf(py, px)) { + if (ny === -Infinity) { return false; } - if (isPrefixOf(px, py)) { + if (nx === -Infinity) { return true; } - return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f + return nx < ny; // by now, these are both nonzero, finite, and not equal }; diff --git a/docs/snippets/node_modules/es-abstract/2019/CharacterRange.js b/docs/snippets/node_modules/es-abstract/2019/CharacterRange.js new file mode 100644 index 00000000..70e4b523 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2019/CharacterRange.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $charCodeAt = callBound('%String.prototype.charCodeAt%'); +var $push = callBound('%Array.prototype.push%'); + +module.exports = function CharacterRange(A, B) { + if (A.length !== 1 || B.length !== 1) { + throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); + } + + var a = A[0]; + var b = B[0]; + + var i = $charCodeAt(a, 0); + var j = $charCodeAt(b, 0); + + if (!(i <= j)) { + throw new $TypeError('Assertion failed: i is not <= j'); + } + + var arr = []; + for (var k = i; k <= j; k += 1) { + $push(arr, $fromCharCode(k)); + } + return arr; +}; diff --git a/docs/snippets/node_modules/es-abstract/2019/IsCompatiblePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2019/IsCompatiblePropertyDescriptor.js new file mode 100644 index 00000000..8bdaf3eb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2019/IsCompatiblePropertyDescriptor.js @@ -0,0 +1,9 @@ +'use strict'; + +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor + +module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { + return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2019/IsSharedArrayBuffer.js b/docs/snippets/node_modules/es-abstract/2019/IsSharedArrayBuffer.js new file mode 100644 index 00000000..8e96e33f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2019/IsSharedArrayBuffer.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('./Type'); + +var isSharedArrayBuffer = require('is-shared-array-buffer'); + +// https://262.ecma-international.org/8.0/#sec-issharedarraybuffer + +module.exports = function IsSharedArrayBuffer(obj) { + if (Type(obj) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + return isSharedArrayBuffer(obj); +}; diff --git a/docs/snippets/node_modules/es-abstract/2019/OrdinaryToPrimitive.js b/docs/snippets/node_modules/es-abstract/2019/OrdinaryToPrimitive.js new file mode 100644 index 00000000..e1dbe142 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2019/OrdinaryToPrimitive.js @@ -0,0 +1,38 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +var inspect = require('object-inspect'); + +// https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive + +module.exports = function OrdinaryToPrimitive(O, hint) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { + throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); + } + + var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; + + for (var i = 0; i < methodNames.length; i += 1) { + var name = methodNames[i]; + var method = Get(O, name); + if (IsCallable(method)) { + var result = Call(method, O); + if (Type(result) !== 'Object') { + return result; + } + } + } + + throw new $TypeError('No primitive value for ' + inspect(O)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2019/Set.js b/docs/snippets/node_modules/es-abstract/2019/Set.js index ea49e813..09714988 100644 --- a/docs/snippets/node_modules/es-abstract/2019/Set.js +++ b/docs/snippets/node_modules/es-abstract/2019/Set.js @@ -36,12 +36,12 @@ module.exports = function Set(O, P, V, Throw) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; - } else { - try { - O[P] = V; // eslint-disable-line no-param-reassign - return noThrowOnStrictViolation ? SameValue(O[P], V) : true; - } catch (e) { - return false; - } } + try { + O[P] = V; // eslint-disable-line no-param-reassign + return noThrowOnStrictViolation ? SameValue(O[P], V) : true; + } catch (e) { + return false; + } + }; diff --git a/docs/snippets/node_modules/es-abstract/2019/SetFunctionName.js b/docs/snippets/node_modules/es-abstract/2019/SetFunctionName.js index f59cb7b9..03ec2227 100644 --- a/docs/snippets/node_modules/es-abstract/2019/SetFunctionName.js +++ b/docs/snippets/node_modules/es-abstract/2019/SetFunctionName.js @@ -6,7 +6,7 @@ var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); -var getSymbolDescription = require('../helpers/getSymbolDescription'); +var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); diff --git a/docs/snippets/node_modules/es-abstract/2019/ToNumber.js b/docs/snippets/node_modules/es-abstract/2019/ToNumber.js index e776bb2b..197b5c57 100644 --- a/docs/snippets/node_modules/es-abstract/2019/ToNumber.js +++ b/docs/snippets/node_modules/es-abstract/2019/ToNumber.js @@ -48,12 +48,12 @@ module.exports = function ToNumber(argument) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; - } else { - var trimmed = $trim(value); - if (trimmed !== value) { - return ToNumber(trimmed); - } } + var trimmed = $trim(value); + if (trimmed !== value) { + return ToNumber(trimmed); + } + } return $Number(value); }; diff --git a/docs/snippets/node_modules/es-abstract/2020/AbstractEqualityComparison.js b/docs/snippets/node_modules/es-abstract/2020/AbstractEqualityComparison.js index c776194c..83b29496 100644 --- a/docs/snippets/node_modules/es-abstract/2020/AbstractEqualityComparison.js +++ b/docs/snippets/node_modules/es-abstract/2020/AbstractEqualityComparison.js @@ -1,16 +1,20 @@ 'use strict'; +var StrictEqualityComparison = require('./StrictEqualityComparison'); +var StringToBigInt = require('./StringToBigInt'); var ToNumber = require('./ToNumber'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); -// https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison +var isNaN = require('../helpers/isNaN'); + +// https://ecma-international.org/ecma-262/11.0/#sec-abstract-equality-comparison module.exports = function AbstractEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType === yType) { - return x === y; // ES6+ specified this shortcut anyways. + return StrictEqualityComparison(x, y); } if (x == null && y == null) { return true; @@ -21,17 +25,33 @@ module.exports = function AbstractEqualityComparison(x, y) { if (xType === 'String' && yType === 'Number') { return AbstractEqualityComparison(ToNumber(x), y); } + if (xType === 'BigInt' && yType === 'String') { + var n = StringToBigInt(y); + if (isNaN(n)) { + return false; + } + return AbstractEqualityComparison(x, n); + } + if (xType === 'String' && yType === 'BigInt') { + return AbstractEqualityComparison(y, x); + } if (xType === 'Boolean') { return AbstractEqualityComparison(ToNumber(x), y); } if (yType === 'Boolean') { return AbstractEqualityComparison(x, ToNumber(y)); } - if ((xType === 'String' || xType === 'Number' || xType === 'Symbol') && yType === 'Object') { + if ((xType === 'String' || xType === 'Number' || xType === 'BigInt' || xType === 'Symbol') && yType === 'Object') { return AbstractEqualityComparison(x, ToPrimitive(y)); } - if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'Symbol')) { + if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'BigInt' || yType === 'Symbol')) { return AbstractEqualityComparison(ToPrimitive(x), y); } + if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) { + if (isNaN(x) || isNaN(y) || x === Infinity || y === Infinity || x === -Infinity || y === -Infinity) { + return false; + } + return x == y; // eslint-disable-line eqeqeq + } return false; }; diff --git a/docs/snippets/node_modules/es-abstract/2020/AbstractRelationalComparison.js b/docs/snippets/node_modules/es-abstract/2020/AbstractRelationalComparison.js index 0dfed5ff..53482944 100644 --- a/docs/snippets/node_modules/es-abstract/2020/AbstractRelationalComparison.js +++ b/docs/snippets/node_modules/es-abstract/2020/AbstractRelationalComparison.js @@ -6,16 +6,19 @@ var $Number = GetIntrinsic('%Number%'); var $TypeError = GetIntrinsic('%TypeError%'); var $isNaN = require('../helpers/isNaN'); -var $isFinite = require('../helpers/isFinite'); -var isPrefixOf = require('../helpers/isPrefixOf'); -var ToNumber = require('./ToNumber'); +var IsStringPrefix = require('./IsStringPrefix'); +var StringToBigInt = require('./StringToBigInt'); +var ToNumeric = require('./ToNumeric'); var ToPrimitive = require('./ToPrimitive'); var Type = require('./Type'); -// https://262.ecma-international.org/5.1/#sec-11.8.5 +var BigIntLessThan = require('./BigInt/lessThan'); +var NumberLessThan = require('./Number/lessThan'); -// eslint-disable-next-line max-statements +// https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison + +// eslint-disable-next-line max-statements, max-lines-per-function module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { if (Type(LeftFirst) !== 'Boolean') { throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); @@ -29,35 +32,51 @@ module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { py = ToPrimitive(y, $Number); px = ToPrimitive(x, $Number); } - var bothStrings = Type(px) === 'String' && Type(py) === 'String'; - if (!bothStrings) { - var nx = ToNumber(px); - var ny = ToNumber(py); - if ($isNaN(nx) || $isNaN(ny)) { - return undefined; - } - if ($isFinite(nx) && $isFinite(ny) && nx === ny) { - return false; - } - if (nx === Infinity) { + if (Type(px) === 'String' && Type(py) === 'String') { + if (IsStringPrefix(py, px)) { return false; } - if (ny === Infinity) { + if (IsStringPrefix(px, py)) { return true; } - if (ny === -Infinity) { - return false; + return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f + } + + var pxType = Type(px); + var pyType = Type(py); + var nx; + var ny; + if (pxType === 'BigInt' && pyType === 'String') { + ny = StringToBigInt(py); + if ($isNaN(ny)) { + return void undefined; } - if (nx === -Infinity) { - return true; + return BigIntLessThan(px, ny); + } + if (pxType === 'String' && pyType === 'BigInt') { + nx = StringToBigInt(px); + if ($isNaN(nx)) { + return void undefined; } - return nx < ny; // by now, these are both nonzero, finite, and not equal + return BigIntLessThan(px, ny); } - if (isPrefixOf(py, px)) { - return false; + + nx = ToNumeric(px); + ny = ToNumeric(py); + var nxType = Type(nx); + if (nxType === Type(ny)) { + return nxType === 'Number' ? NumberLessThan(nx, ny) : BigIntLessThan(nx, ny); + } + + if ($isNaN(nx) || $isNaN(ny)) { + return void undefined; } - if (isPrefixOf(px, py)) { + if (nx === -Infinity || ny === Infinity) { return true; } - return px < py; // both strings, neither a prefix of the other. shortcut for steps c-f + if (nx === Infinity || ny === -Infinity) { + return false; + } + + return nx < ny; // by now, these are both nonzero, finite, and not equal }; diff --git a/docs/snippets/node_modules/es-abstract/2020/CharacterRange.js b/docs/snippets/node_modules/es-abstract/2020/CharacterRange.js new file mode 100644 index 00000000..70e4b523 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/CharacterRange.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $charCodeAt = callBound('%String.prototype.charCodeAt%'); +var $push = callBound('%Array.prototype.push%'); + +module.exports = function CharacterRange(A, B) { + if (A.length !== 1 || B.length !== 1) { + throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); + } + + var a = A[0]; + var b = B[0]; + + var i = $charCodeAt(a, 0); + var j = $charCodeAt(b, 0); + + if (!(i <= j)) { + throw new $TypeError('Assertion failed: i is not <= j'); + } + + var arr = []; + for (var k = i; k <= j; k += 1) { + $push(arr, $fromCharCode(k)); + } + return arr; +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/CreateRegExpStringIterator.js b/docs/snippets/node_modules/es-abstract/2020/CreateRegExpStringIterator.js new file mode 100644 index 00000000..dd493e48 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/CreateRegExpStringIterator.js @@ -0,0 +1,111 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var hasSymbols = require('has-symbols')(); + +var $TypeError = GetIntrinsic('%TypeError%'); +var IteratorPrototype = GetIntrinsic('%IteratorPrototype%', true); +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); + +var AdvanceStringIndex = require('./AdvanceStringIndex'); +var CreateIterResultObject = require('./CreateIterResultObject'); +var CreateMethodProperty = require('./CreateMethodProperty'); +var Get = require('./Get'); +var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); +var RegExpExec = require('./RegExpExec'); +var Set = require('./Set'); +var ToLength = require('./ToLength'); +var ToString = require('./ToString'); +var Type = require('./Type'); + +var SLOT = require('internal-slot'); + +var RegExpStringIterator = function RegExpStringIterator(R, S, global, fullUnicode) { + if (Type(S) !== 'String') { + throw new $TypeError('`S` must be a string'); + } + if (Type(global) !== 'Boolean') { + throw new $TypeError('`global` must be a boolean'); + } + if (Type(fullUnicode) !== 'Boolean') { + throw new $TypeError('`fullUnicode` must be a boolean'); + } + SLOT.set(this, '[[IteratingRegExp]]', R); + SLOT.set(this, '[[IteratedString]]', S); + SLOT.set(this, '[[Global]]', global); + SLOT.set(this, '[[Unicode]]', fullUnicode); + SLOT.set(this, '[[Done]]', false); +}; + +if (IteratorPrototype) { + RegExpStringIterator.prototype = OrdinaryObjectCreate(IteratorPrototype); +} + +var RegExpStringIteratorNext = function next() { + var O = this; // eslint-disable-line no-invalid-this + if (Type(O) !== 'Object') { + throw new $TypeError('receiver must be an object'); + } + if ( + !(O instanceof RegExpStringIterator) + || !SLOT.has(O, '[[IteratingRegExp]]') + || !SLOT.has(O, '[[IteratedString]]') + || !SLOT.has(O, '[[Global]]') + || !SLOT.has(O, '[[Unicode]]') + || !SLOT.has(O, '[[Done]]') + ) { + throw new $TypeError('"this" value must be a RegExpStringIterator instance'); + } + if (SLOT.get(O, '[[Done]]')) { + return CreateIterResultObject(undefined, true); + } + var R = SLOT.get(O, '[[IteratingRegExp]]'); + var S = SLOT.get(O, '[[IteratedString]]'); + var global = SLOT.get(O, '[[Global]]'); + var fullUnicode = SLOT.get(O, '[[Unicode]]'); + var match = RegExpExec(R, S); + if (match === null) { + SLOT.set(O, '[[Done]]', true); + return CreateIterResultObject(undefined, true); + } + if (global) { + var matchStr = ToString(Get(match, '0')); + if (matchStr === '') { + var thisIndex = ToLength(Get(R, 'lastIndex')); + var nextIndex = AdvanceStringIndex(S, thisIndex, fullUnicode); + Set(R, 'lastIndex', nextIndex, true); + } + return CreateIterResultObject(match, false); + } + SLOT.set(O, '[[Done]]', true); + return CreateIterResultObject(match, false); +}; +CreateMethodProperty(RegExpStringIterator.prototype, 'next', RegExpStringIteratorNext); + +if (hasSymbols) { + if (Symbol.toStringTag) { + if ($defineProperty) { + $defineProperty(RegExpStringIterator.prototype, Symbol.toStringTag, { + configurable: true, + enumerable: false, + value: 'RegExp String Iterator', + writable: false + }); + } else { + RegExpStringIterator.prototype[Symbol.toStringTag] = 'RegExp String Iterator'; + } + } + + if (Symbol.iterator && typeof RegExpStringIterator.prototype[Symbol.iterator] !== 'function') { + var iteratorFn = function SymbolIterator() { + return this; + }; + CreateMethodProperty(RegExpStringIterator.prototype, Symbol.iterator, iteratorFn); + } +} + +// https://262.ecma-international.org/11.0/#sec-createregexpstringiterator +module.exports = function CreateRegExpStringIterator(R, S, global, fullUnicode) { + // assert R.global === global && R.unicode === fullUnicode? + return new RegExpStringIterator(R, S, global, fullUnicode); +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/IsCompatiblePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2020/IsCompatiblePropertyDescriptor.js new file mode 100644 index 00000000..8bdaf3eb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/IsCompatiblePropertyDescriptor.js @@ -0,0 +1,9 @@ +'use strict'; + +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor + +module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { + return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/IsSharedArrayBuffer.js b/docs/snippets/node_modules/es-abstract/2020/IsSharedArrayBuffer.js new file mode 100644 index 00000000..8e96e33f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/IsSharedArrayBuffer.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('./Type'); + +var isSharedArrayBuffer = require('is-shared-array-buffer'); + +// https://262.ecma-international.org/8.0/#sec-issharedarraybuffer + +module.exports = function IsSharedArrayBuffer(obj) { + if (Type(obj) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + return isSharedArrayBuffer(obj); +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/NumberToBigInt.js b/docs/snippets/node_modules/es-abstract/2020/NumberToBigInt.js index a186988c..84649847 100644 --- a/docs/snippets/node_modules/es-abstract/2020/NumberToBigInt.js +++ b/docs/snippets/node_modules/es-abstract/2020/NumberToBigInt.js @@ -4,6 +4,7 @@ var GetIntrinsic = require('get-intrinsic'); var $BigInt = GetIntrinsic('%BigInt%', true); var $RangeError = GetIntrinsic('%RangeError%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); var $TypeError = GetIntrinsic('%TypeError%'); var IsInteger = require('./IsInteger'); @@ -18,5 +19,8 @@ module.exports = function NumberToBigInt(number) { if (!IsInteger(number)) { throw new $RangeError('The number ' + number + ' cannot be converted to a BigInt because it is not an integer'); } + if (!$BigInt) { + throw new $SyntaxError('BigInts are not supported in this environment'); + } return $BigInt(number); }; diff --git a/docs/snippets/node_modules/es-abstract/2020/OrdinaryToPrimitive.js b/docs/snippets/node_modules/es-abstract/2020/OrdinaryToPrimitive.js new file mode 100644 index 00000000..e1dbe142 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/OrdinaryToPrimitive.js @@ -0,0 +1,38 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +var inspect = require('object-inspect'); + +// https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive + +module.exports = function OrdinaryToPrimitive(O, hint) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { + throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); + } + + var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; + + for (var i = 0; i < methodNames.length; i += 1) { + var name = methodNames[i]; + var method = Get(O, name); + if (IsCallable(method)) { + var result = Call(method, O); + if (Type(result) !== 'Object') { + return result; + } + } + } + + throw new $TypeError('No primitive value for ' + inspect(O)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/Set.js b/docs/snippets/node_modules/es-abstract/2020/Set.js index ea49e813..09714988 100644 --- a/docs/snippets/node_modules/es-abstract/2020/Set.js +++ b/docs/snippets/node_modules/es-abstract/2020/Set.js @@ -36,12 +36,12 @@ module.exports = function Set(O, P, V, Throw) { throw new $TypeError('Attempted to assign to readonly property.'); } return true; - } else { - try { - O[P] = V; // eslint-disable-line no-param-reassign - return noThrowOnStrictViolation ? SameValue(O[P], V) : true; - } catch (e) { - return false; - } } + try { + O[P] = V; // eslint-disable-line no-param-reassign + return noThrowOnStrictViolation ? SameValue(O[P], V) : true; + } catch (e) { + return false; + } + }; diff --git a/docs/snippets/node_modules/es-abstract/2020/SetFunctionName.js b/docs/snippets/node_modules/es-abstract/2020/SetFunctionName.js index f59cb7b9..03ec2227 100644 --- a/docs/snippets/node_modules/es-abstract/2020/SetFunctionName.js +++ b/docs/snippets/node_modules/es-abstract/2020/SetFunctionName.js @@ -6,7 +6,7 @@ var has = require('has'); var $TypeError = GetIntrinsic('%TypeError%'); -var getSymbolDescription = require('../helpers/getSymbolDescription'); +var getSymbolDescription = require('get-symbol-description'); var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); var IsExtensible = require('./IsExtensible'); diff --git a/docs/snippets/node_modules/es-abstract/2020/StringToBigInt.js b/docs/snippets/node_modules/es-abstract/2020/StringToBigInt.js new file mode 100644 index 00000000..0bc3cec0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/StringToBigInt.js @@ -0,0 +1,23 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $TypeError = GetIntrinsic('%TypeError%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); + +// https://262.ecma-international.org/11.0/#sec-stringtobigint + +module.exports = function StringToBigInt(argument) { + if (typeof argument !== 'string') { + throw new $TypeError('`argument` must be a string'); + } + if (!$BigInt) { + throw new $SyntaxError('BigInts are not supported in this environment'); + } + try { + return $BigInt(argument); + } catch (e) { + return NaN; + } +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/ToBigInt.js b/docs/snippets/node_modules/es-abstract/2020/ToBigInt.js new file mode 100644 index 00000000..aa24d7b7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/ToBigInt.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $asIntN = GetIntrinsic('%BigInt.asIntN%', true); +var $Number = GetIntrinsic('%Number%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); + +var ToPrimitive = require('./ToPrimitive'); + +// https://262.ecma-international.org/11.0/#sec-tobigint + +module.exports = function ToBigInt(argument) { + if (!$BigInt) { + throw new $SyntaxError('BigInts are not supported in this environment'); + } + + var prim = ToPrimitive(argument, $Number); + + if (typeof prim === 'number') { + return $asIntN(0, prim); + } + return $BigInt(prim); +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/ToBigInt64.js b/docs/snippets/node_modules/es-abstract/2020/ToBigInt64.js new file mode 100644 index 00000000..65c1c55d --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/ToBigInt64.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $pow = GetIntrinsic('%Math.pow%'); + +var ToBigInt = require('./ToBigInt'); +var BigIntRemainder = require('./BigInt/remainder'); + +var modBigInt = require('../helpers/modBigInt'); + +// BigInt(2**63), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER +var twoSixtyThree = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 31))); + +// BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER +var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); + +// https://262.ecma-international.org/11.0/#sec-tobigint64 + +module.exports = function ToBigInt64(argument) { + var n = ToBigInt(argument); + var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); + return int64bit >= twoSixtyThree ? int64bit - twoSixtyFour : int64bit; +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/ToBigUint64.js b/docs/snippets/node_modules/es-abstract/2020/ToBigUint64.js new file mode 100644 index 00000000..ff68236a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2020/ToBigUint64.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $pow = GetIntrinsic('%Math.pow%'); + +var ToBigInt = require('./ToBigInt'); +var BigIntRemainder = require('./BigInt/remainder'); + +var modBigInt = require('../helpers/modBigInt'); + +// BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER +var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); + +// https://262.ecma-international.org/11.0/#sec-tobiguint64 + +module.exports = function ToBigUint64(argument) { + var n = ToBigInt(argument); + var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); + return int64bit; +}; diff --git a/docs/snippets/node_modules/es-abstract/2020/ToNumber.js b/docs/snippets/node_modules/es-abstract/2020/ToNumber.js index fcddeb66..3b00377a 100644 --- a/docs/snippets/node_modules/es-abstract/2020/ToNumber.js +++ b/docs/snippets/node_modules/es-abstract/2020/ToNumber.js @@ -51,12 +51,12 @@ module.exports = function ToNumber(argument) { return ToNumber($parseInteger($strSlice(value, 2), 8)); } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { return NaN; - } else { - var trimmed = $trim(value); - if (trimmed !== value) { - return ToNumber(trimmed); - } } + var trimmed = $trim(value); + if (trimmed !== value) { + return ToNumber(trimmed); + } + } return $Number(value); }; diff --git a/docs/snippets/node_modules/es-abstract/2021/AbstractEqualityComparison.js b/docs/snippets/node_modules/es-abstract/2021/AbstractEqualityComparison.js new file mode 100644 index 00000000..83b29496 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/AbstractEqualityComparison.js @@ -0,0 +1,57 @@ +'use strict'; + +var StrictEqualityComparison = require('./StrictEqualityComparison'); +var StringToBigInt = require('./StringToBigInt'); +var ToNumber = require('./ToNumber'); +var ToPrimitive = require('./ToPrimitive'); +var Type = require('./Type'); + +var isNaN = require('../helpers/isNaN'); + +// https://ecma-international.org/ecma-262/11.0/#sec-abstract-equality-comparison + +module.exports = function AbstractEqualityComparison(x, y) { + var xType = Type(x); + var yType = Type(y); + if (xType === yType) { + return StrictEqualityComparison(x, y); + } + if (x == null && y == null) { + return true; + } + if (xType === 'Number' && yType === 'String') { + return AbstractEqualityComparison(x, ToNumber(y)); + } + if (xType === 'String' && yType === 'Number') { + return AbstractEqualityComparison(ToNumber(x), y); + } + if (xType === 'BigInt' && yType === 'String') { + var n = StringToBigInt(y); + if (isNaN(n)) { + return false; + } + return AbstractEqualityComparison(x, n); + } + if (xType === 'String' && yType === 'BigInt') { + return AbstractEqualityComparison(y, x); + } + if (xType === 'Boolean') { + return AbstractEqualityComparison(ToNumber(x), y); + } + if (yType === 'Boolean') { + return AbstractEqualityComparison(x, ToNumber(y)); + } + if ((xType === 'String' || xType === 'Number' || xType === 'BigInt' || xType === 'Symbol') && yType === 'Object') { + return AbstractEqualityComparison(x, ToPrimitive(y)); + } + if (xType === 'Object' && (yType === 'String' || yType === 'Number' || yType === 'BigInt' || yType === 'Symbol')) { + return AbstractEqualityComparison(ToPrimitive(x), y); + } + if ((xType === 'BigInt' && yType === 'Number') || (xType === 'Number' && yType === 'BigInt')) { + if (isNaN(x) || isNaN(y) || x === Infinity || y === Infinity || x === -Infinity || y === -Infinity) { + return false; + } + return x == y; // eslint-disable-line eqeqeq + } + return false; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/AbstractRelationalComparison.js b/docs/snippets/node_modules/es-abstract/2021/AbstractRelationalComparison.js new file mode 100644 index 00000000..53482944 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/AbstractRelationalComparison.js @@ -0,0 +1,82 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Number = GetIntrinsic('%Number%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var $isNaN = require('../helpers/isNaN'); + +var IsStringPrefix = require('./IsStringPrefix'); +var StringToBigInt = require('./StringToBigInt'); +var ToNumeric = require('./ToNumeric'); +var ToPrimitive = require('./ToPrimitive'); +var Type = require('./Type'); + +var BigIntLessThan = require('./BigInt/lessThan'); +var NumberLessThan = require('./Number/lessThan'); + +// https://262.ecma-international.org/9.0/#sec-abstract-relational-comparison + +// eslint-disable-next-line max-statements, max-lines-per-function +module.exports = function AbstractRelationalComparison(x, y, LeftFirst) { + if (Type(LeftFirst) !== 'Boolean') { + throw new $TypeError('Assertion failed: LeftFirst argument must be a Boolean'); + } + var px; + var py; + if (LeftFirst) { + px = ToPrimitive(x, $Number); + py = ToPrimitive(y, $Number); + } else { + py = ToPrimitive(y, $Number); + px = ToPrimitive(x, $Number); + } + if (Type(px) === 'String' && Type(py) === 'String') { + if (IsStringPrefix(py, px)) { + return false; + } + if (IsStringPrefix(px, py)) { + return true; + } + return px < py; // both strings, neither a prefix of the other. shortcut for steps 3 c-f + } + + var pxType = Type(px); + var pyType = Type(py); + var nx; + var ny; + if (pxType === 'BigInt' && pyType === 'String') { + ny = StringToBigInt(py); + if ($isNaN(ny)) { + return void undefined; + } + return BigIntLessThan(px, ny); + } + if (pxType === 'String' && pyType === 'BigInt') { + nx = StringToBigInt(px); + if ($isNaN(nx)) { + return void undefined; + } + return BigIntLessThan(px, ny); + } + + nx = ToNumeric(px); + ny = ToNumeric(py); + var nxType = Type(nx); + if (nxType === Type(ny)) { + return nxType === 'Number' ? NumberLessThan(nx, ny) : BigIntLessThan(nx, ny); + } + + if ($isNaN(nx) || $isNaN(ny)) { + return void undefined; + } + if (nx === -Infinity || ny === Infinity) { + return true; + } + if (nx === Infinity || ny === -Infinity) { + return false; + } + + return nx < ny; // by now, these are both nonzero, finite, and not equal +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/AddEntriesFromIterable.js b/docs/snippets/node_modules/es-abstract/2021/AddEntriesFromIterable.js new file mode 100644 index 00000000..a0a5e71b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/AddEntriesFromIterable.js @@ -0,0 +1,52 @@ +'use strict'; + +var inspect = require('object-inspect'); + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var Get = require('./Get'); +var GetIterator = require('./GetIterator'); +var IsCallable = require('./IsCallable'); +var IteratorClose = require('./IteratorClose'); +var IteratorStep = require('./IteratorStep'); +var IteratorValue = require('./IteratorValue'); +var Type = require('./Type'); + +// https://262.ecma-international.org/10.0//#sec-add-entries-from-iterable + +module.exports = function AddEntriesFromIterable(target, iterable, adder) { + if (!IsCallable(adder)) { + throw new $TypeError('Assertion failed: `adder` is not callable'); + } + if (iterable == null) { + throw new $TypeError('Assertion failed: `iterable` is present, and not nullish'); + } + var iteratorRecord = GetIterator(iterable); + while (true) { // eslint-disable-line no-constant-condition + var next = IteratorStep(iteratorRecord); + if (!next) { + return target; + } + var nextItem = IteratorValue(next); + if (Type(nextItem) !== 'Object') { + var error = new $TypeError('iterator next must return an Object, got ' + inspect(nextItem)); + return IteratorClose( + iteratorRecord, + function () { throw error; } // eslint-disable-line no-loop-func + ); + } + try { + var k = Get(nextItem, '0'); + var v = Get(nextItem, '1'); + Call(adder, target, [k, v]); + } catch (e) { + return IteratorClose( + iteratorRecord, + function () { throw e; } + ); + } + } +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/AddToKeptObjects.js b/docs/snippets/node_modules/es-abstract/2021/AddToKeptObjects.js new file mode 100644 index 00000000..c3088d99 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/AddToKeptObjects.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); +var SLOT = require('internal-slot'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var ClearKeptObjects = require('./ClearKeptObjects'); +var Type = require('./Type'); + +var $push = callBound('Array.prototype.push'); + +// https://ecma-international.org/ecma-262/12.0/#sec-addtokeptobjects + +module.exports = function AddToKeptObjects(object) { + if (Type(object) !== 'Object') { + throw new $TypeError('Assertion failed: `object` must be an Object'); + } + $push(SLOT.get(ClearKeptObjects, '[[es-abstract internal: KeptAlive]]'), object); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/AdvanceStringIndex.js b/docs/snippets/node_modules/es-abstract/2021/AdvanceStringIndex.js new file mode 100644 index 00000000..eeae5312 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/AdvanceStringIndex.js @@ -0,0 +1,34 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var CodePointAt = require('./CodePointAt'); +var IsIntegralNumber = require('./IsIntegralNumber'); +var Type = require('./Type'); + +var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +// https://ecma-international.org/ecma-262/12.0/#sec-advancestringindex + +module.exports = function AdvanceStringIndex(S, index, unicode) { + if (Type(S) !== 'String') { + throw new $TypeError('Assertion failed: `S` must be a String'); + } + if (!IsIntegralNumber(index) || index < 0 || index > MAX_SAFE_INTEGER) { + throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53'); + } + if (Type(unicode) !== 'Boolean') { + throw new $TypeError('Assertion failed: `unicode` must be a Boolean'); + } + if (!unicode) { + return index + 1; + } + var length = S.length; + if ((index + 1) >= length) { + return index + 1; + } + var cp = CodePointAt(S, index); + return index + cp['[[CodeUnitCount]]']; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ApplyStringOrNumericBinaryOperator.js b/docs/snippets/node_modules/es-abstract/2021/ApplyStringOrNumericBinaryOperator.js new file mode 100644 index 00000000..824a1054 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ApplyStringOrNumericBinaryOperator.js @@ -0,0 +1,80 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var HasOwnProperty = require('./HasOwnProperty'); +var ToNumeric = require('./ToNumeric'); +var ToPrimitive = require('./ToPrimitive'); +var ToString = require('./ToString'); +var Type = require('./Type'); + +var NumberAdd = require('./Number/add'); +var NumberBitwiseAND = require('./Number/bitwiseAND'); +var NumberBitwiseOR = require('./Number/bitwiseOR'); +var NumberBitwiseXOR = require('./Number/bitwiseXOR'); +var NumberDivide = require('./Number/divide'); +var NumberExponentiate = require('./Number/exponentiate'); +var NumberLeftShift = require('./Number/leftShift'); +var NumberMultiply = require('./Number/multiply'); +var NumberRemainder = require('./Number/remainder'); +var NumberSignedRightShift = require('./Number/signedRightShift'); +var NumberSubtract = require('./Number/subtract'); +var NumberUnsignedRightShift = require('./Number/unsignedRightShift'); +var BigIntAdd = require('./BigInt/add'); +var BigIntBitwiseAND = require('./BigInt/bitwiseAND'); +var BigIntBitwiseOR = require('./BigInt/bitwiseOR'); +var BigIntBitwiseXOR = require('./BigInt/bitwiseXOR'); +var BigIntDivide = require('./BigInt/divide'); +var BigIntExponentiate = require('./BigInt/exponentiate'); +var BigIntLeftShift = require('./BigInt/leftShift'); +var BigIntMultiply = require('./BigInt/multiply'); +var BigIntRemainder = require('./BigInt/remainder'); +var BigIntSignedRightShift = require('./BigInt/signedRightShift'); +var BigIntSubtract = require('./BigInt/subtract'); +var BigIntUnsignedRightShift = require('./BigInt/unsignedRightShift'); + +// https://ecma-international.org/ecma-262/12.0/#sec-applystringornumericbinaryoperator + +// https://ecma-international.org/ecma-262/12.0/#step-applystringornumericbinaryoperator-operations-table +var table = { + '**': [NumberExponentiate, BigIntExponentiate], + '*': [NumberMultiply, BigIntMultiply], + '/': [NumberDivide, BigIntDivide], + '%': [NumberRemainder, BigIntRemainder], + '+': [NumberAdd, BigIntAdd], + '-': [NumberSubtract, BigIntSubtract], + '<<': [NumberLeftShift, BigIntLeftShift], + '>>': [NumberSignedRightShift, BigIntSignedRightShift], + '>>>': [NumberUnsignedRightShift, BigIntUnsignedRightShift], + '&': [NumberBitwiseAND, BigIntBitwiseAND], + '^': [NumberBitwiseXOR, BigIntBitwiseXOR], + '|': [NumberBitwiseOR, BigIntBitwiseOR] +}; + +module.exports = function ApplyStringOrNumericBinaryOperator(lval, opText, rval) { + if (Type(opText) !== 'String' || !HasOwnProperty(table, opText)) { + throw new $TypeError('Assertion failed: `opText` must be a valid operation string'); + } + if (opText === '+') { + var lprim = ToPrimitive(lval); + var rprim = ToPrimitive(rval); + if (Type(lprim) === 'String' || Type(rprim) === 'String') { + var lstr = ToString(lprim); + var rstr = ToString(rprim); + return lstr + rstr; + } + /* eslint no-param-reassign: 1 */ + lval = lprim; + rval = rprim; + } + var lnum = ToNumeric(lval); + var rnum = ToNumeric(rval); + var T = Type(lnum); + if (T !== Type(rnum)) { + throw new $TypeError('types of ' + lnum + ' and ' + rnum + ' differ'); + } + var Operation = table[opText][T === 'BigInt' ? 1 : 0]; + return Operation(lnum, rnum); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ArrayCreate.js b/docs/snippets/node_modules/es-abstract/2021/ArrayCreate.js new file mode 100644 index 00000000..5f3e1542 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ArrayCreate.js @@ -0,0 +1,53 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $ArrayPrototype = GetIntrinsic('%Array.prototype%'); +var $RangeError = GetIntrinsic('%RangeError%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsIntegralNumber = require('./IsIntegralNumber'); + +var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1; + +var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || ( + // eslint-disable-next-line no-proto, no-negated-condition + [].__proto__ !== $ArrayPrototype + ? null + : function (O, proto) { + O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign + return O; + } +); + +// https://www.ecma-international.org/ecma-262/12.0/#sec-arraycreate + +module.exports = function ArrayCreate(length) { + if (!IsIntegralNumber(length) || length < 0) { + throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0'); + } + if (length > MAX_ARRAY_LENGTH) { + throw new $RangeError('length is greater than (2**32 - 1)'); + } + var proto = arguments.length > 1 ? arguments[1] : $ArrayPrototype; + var A = []; // steps 3, 5 + if (proto !== $ArrayPrototype) { // step 4 + if (!$setProto) { + throw new $SyntaxError('ArrayCreate: a `proto` argument that is not `Array.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); + } + $setProto(A, proto); + } + if (length !== 0) { // bypasses the need for step 6 + A.length = length; + } + /* step 6, the above as a shortcut for the below + OrdinaryDefineOwnProperty(A, 'length', { + '[[Configurable]]': false, + '[[Enumerable]]': false, + '[[Value]]': length, + '[[Writable]]': true + }); + */ + return A; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ArraySetLength.js b/docs/snippets/node_modules/es-abstract/2021/ArraySetLength.js new file mode 100644 index 00000000..08db9c2e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ArraySetLength.js @@ -0,0 +1,85 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $RangeError = GetIntrinsic('%RangeError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var assign = require('object.assign'); + +var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); + +var IsArray = require('./IsArray'); +var IsAccessorDescriptor = require('./IsAccessorDescriptor'); +var IsDataDescriptor = require('./IsDataDescriptor'); +var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty'); +var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); +var ToNumber = require('./ToNumber'); +var ToString = require('./ToString'); +var ToUint32 = require('./ToUint32'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength + +// eslint-disable-next-line max-statements, max-lines-per-function +module.exports = function ArraySetLength(A, Desc) { + if (!IsArray(A)) { + throw new $TypeError('Assertion failed: A must be an Array'); + } + if (!isPropertyDescriptor({ + Type: Type, + IsDataDescriptor: IsDataDescriptor, + IsAccessorDescriptor: IsAccessorDescriptor + }, Desc)) { + throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); + } + if (!('[[Value]]' in Desc)) { + return OrdinaryDefineOwnProperty(A, 'length', Desc); + } + var newLenDesc = assign({}, Desc); + var newLen = ToUint32(Desc['[[Value]]']); + var numberLen = ToNumber(Desc['[[Value]]']); + if (newLen !== numberLen) { + throw new $RangeError('Invalid array length'); + } + newLenDesc['[[Value]]'] = newLen; + var oldLenDesc = OrdinaryGetOwnProperty(A, 'length'); + if (!IsDataDescriptor(oldLenDesc)) { + throw new $TypeError('Assertion failed: an array had a non-data descriptor on `length`'); + } + var oldLen = oldLenDesc['[[Value]]']; + if (newLen >= oldLen) { + return OrdinaryDefineOwnProperty(A, 'length', newLenDesc); + } + if (!oldLenDesc['[[Writable]]']) { + return false; + } + var newWritable; + if (!('[[Writable]]' in newLenDesc) || newLenDesc['[[Writable]]']) { + newWritable = true; + } else { + newWritable = false; + newLenDesc['[[Writable]]'] = true; + } + var succeeded = OrdinaryDefineOwnProperty(A, 'length', newLenDesc); + if (!succeeded) { + return false; + } + while (newLen < oldLen) { + oldLen -= 1; + // eslint-disable-next-line no-param-reassign + var deleteSucceeded = delete A[ToString(oldLen)]; + if (!deleteSucceeded) { + newLenDesc['[[Value]]'] = oldLen + 1; + if (!newWritable) { + newLenDesc['[[Writable]]'] = false; + OrdinaryDefineOwnProperty(A, 'length', newLenDesc); + return false; + } + } + } + if (!newWritable) { + return OrdinaryDefineOwnProperty(A, 'length', { '[[Writable]]': false }); + } + return true; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ArraySpeciesCreate.js b/docs/snippets/node_modules/es-abstract/2021/ArraySpeciesCreate.js new file mode 100644 index 00000000..d908fa35 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ArraySpeciesCreate.js @@ -0,0 +1,48 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $species = GetIntrinsic('%Symbol.species%', true); +var $TypeError = GetIntrinsic('%TypeError%'); + +var ArrayCreate = require('./ArrayCreate'); +var Get = require('./Get'); +var IsArray = require('./IsArray'); +var IsConstructor = require('./IsConstructor'); +var IsIntegralNumber = require('./IsIntegralNumber'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/12.0/#sec-arrayspeciescreate + +module.exports = function ArraySpeciesCreate(originalArray, length) { + if (!IsIntegralNumber(length) || length < 0) { + throw new $TypeError('Assertion failed: length must be an integer >= 0'); + } + + var isArray = IsArray(originalArray); + if (!isArray) { + return ArrayCreate(length); + } + + var C = Get(originalArray, 'constructor'); + // TODO: figure out how to make a cross-realm normal Array, a same-realm Array + // if (IsConstructor(C)) { + // if C is another realm's Array, C = undefined + // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ? + // } + if ($species && Type(C) === 'Object') { + C = Get(C, $species); + if (C === null) { + C = void 0; + } + } + + if (typeof C === 'undefined') { + return ArrayCreate(length); + } + if (!IsConstructor(C)) { + throw new $TypeError('C must be a constructor'); + } + return new C(length); // Construct(C, length); +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/add.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/add.js new file mode 100644 index 00000000..22b5db4b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/add.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-add + +module.exports = function BigIntAdd(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + // shortcut for the actual spec mechanics + return x + y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseAND.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseAND.js new file mode 100644 index 00000000..83cd2c3c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseAND.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var BigIntBitwiseOp = require('../BigIntBitwiseOp'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseAND + +module.exports = function BigIntBitwiseAND(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + return BigIntBitwiseOp('&', x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseNOT.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseNOT.js new file mode 100644 index 00000000..9a444dfe --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseNOT.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseNOT + +module.exports = function BigIntBitwiseNOT(x) { + if (Type(x) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); + } + return -x - $BigInt(1); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseOR.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseOR.js new file mode 100644 index 00000000..3c1b5719 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseOR.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var BigIntBitwiseOp = require('../BigIntBitwiseOp'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseOR + +module.exports = function BigIntBitwiseOR(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + return BigIntBitwiseOp('|', x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseXOR.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseXOR.js new file mode 100644 index 00000000..45f8217e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/bitwiseXOR.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var BigIntBitwiseOp = require('../BigIntBitwiseOp'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-bitwiseXOR + +module.exports = function BigIntBitwiseXOR(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + return BigIntBitwiseOp('^', x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/divide.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/divide.js new file mode 100644 index 00000000..5706e7d7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/divide.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $RangeError = GetIntrinsic('%RangeError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-divide + +module.exports = function BigIntDivide(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + if (y === $BigInt(0)) { + throw new $RangeError('Division by zero'); + } + // shortcut for the actual spec mechanics + return x / y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/equal.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/equal.js new file mode 100644 index 00000000..a28826d6 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/equal.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-equal + +module.exports = function BigIntEqual(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + // shortcut for the actual spec mechanics + return x === y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/exponentiate.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/exponentiate.js new file mode 100644 index 00000000..2365838c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/exponentiate.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $RangeError = GetIntrinsic('%RangeError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-exponentiate + +module.exports = function BigIntExponentiate(base, exponent) { + if (Type(base) !== 'BigInt' || Type(exponent) !== 'BigInt') { + throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be BigInts'); + } + if (exponent < $BigInt(0)) { + throw new $RangeError('Exponent must be positive'); + } + if (/* base === $BigInt(0) && */ exponent === $BigInt(0)) { + return $BigInt(1); + } + + var square = base; + var remaining = exponent; + while (remaining > $BigInt(0)) { + square += exponent; + --remaining; // eslint-disable-line no-plusplus + } + return square; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/index.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/index.js new file mode 100644 index 00000000..63ec52da --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/index.js @@ -0,0 +1,43 @@ +'use strict'; + +var add = require('./add'); +var bitwiseAND = require('./bitwiseAND'); +var bitwiseNOT = require('./bitwiseNOT'); +var bitwiseOR = require('./bitwiseOR'); +var bitwiseXOR = require('./bitwiseXOR'); +var divide = require('./divide'); +var equal = require('./equal'); +var exponentiate = require('./exponentiate'); +var leftShift = require('./leftShift'); +var lessThan = require('./lessThan'); +var multiply = require('./multiply'); +var remainder = require('./remainder'); +var sameValue = require('./sameValue'); +var sameValueZero = require('./sameValueZero'); +var signedRightShift = require('./signedRightShift'); +var subtract = require('./subtract'); +var toString = require('./toString'); +var unaryMinus = require('./unaryMinus'); +var unsignedRightShift = require('./unsignedRightShift'); + +module.exports = { + add: add, + bitwiseAND: bitwiseAND, + bitwiseNOT: bitwiseNOT, + bitwiseOR: bitwiseOR, + bitwiseXOR: bitwiseXOR, + divide: divide, + equal: equal, + exponentiate: exponentiate, + leftShift: leftShift, + lessThan: lessThan, + multiply: multiply, + remainder: remainder, + sameValue: sameValue, + sameValueZero: sameValueZero, + signedRightShift: signedRightShift, + subtract: subtract, + toString: toString, + unaryMinus: unaryMinus, + unsignedRightShift: unsignedRightShift +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/leftShift.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/leftShift.js new file mode 100644 index 00000000..d2a57022 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/leftShift.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-leftShift + +module.exports = function BigIntLeftShift(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + // shortcut for the actual spec mechanics + return x << y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/lessThan.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/lessThan.js new file mode 100644 index 00000000..0b3cd6ba --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/lessThan.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-lessThan + +module.exports = function BigIntLessThan(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + // shortcut for the actual spec mechanics + return x < y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/multiply.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/multiply.js new file mode 100644 index 00000000..6e5d56c8 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/multiply.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-multiply + +module.exports = function BigIntMultiply(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + // shortcut for the actual spec mechanics + return x * y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/remainder.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/remainder.js new file mode 100644 index 00000000..d2dc678c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/remainder.js @@ -0,0 +1,30 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $RangeError = GetIntrinsic('%RangeError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +var zero = $BigInt && $BigInt(0); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-remainder + +module.exports = function BigIntRemainder(n, d) { + if (Type(n) !== 'BigInt' || Type(d) !== 'BigInt') { + throw new $TypeError('Assertion failed: `n` and `d` arguments must be BigInts'); + } + + if (d === zero) { + throw new $RangeError('Division by zero'); + } + + if (n === zero) { + return zero; + } + + // shortcut for the actual spec mechanics + return n % d; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/sameValue.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/sameValue.js new file mode 100644 index 00000000..63ff0639 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/sameValue.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); +var BigIntEqual = require('./equal'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValue + +module.exports = function BigIntSameValue(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + return BigIntEqual(x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/sameValueZero.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/sameValueZero.js new file mode 100644 index 00000000..39f262c6 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/sameValueZero.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); +var BigIntEqual = require('./equal'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-sameValueZero + +module.exports = function BigIntSameValueZero(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + return BigIntEqual(x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/signedRightShift.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/signedRightShift.js new file mode 100644 index 00000000..f63c642f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/signedRightShift.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); +var BigIntLeftShift = require('./leftShift'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift + +module.exports = function BigIntSignedRightShift(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + return BigIntLeftShift(x, -y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/subtract.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/subtract.js new file mode 100644 index 00000000..0490784f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/subtract.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-subtract + +module.exports = function BigIntSubtract(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + // shortcut for the actual spec mechanics + return x - y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/toString.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/toString.js new file mode 100644 index 00000000..858d9554 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/toString.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $String = GetIntrinsic('%String%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-tostring + +module.exports = function BigIntToString(x) { + if (Type(x) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` must be a BigInt'); + } + + return $String(x); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/unaryMinus.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/unaryMinus.js new file mode 100644 index 00000000..ee0f7ef1 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/unaryMinus.js @@ -0,0 +1,24 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +var zero = $BigInt && $BigInt(0); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unaryMinus + +module.exports = function BigIntUnaryMinus(x) { + if (Type(x) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` argument must be a BigInt'); + } + + if (x === zero) { + return zero; + } + + return -x; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigInt/unsignedRightShift.js b/docs/snippets/node_modules/es-abstract/2021/BigInt/unsignedRightShift.js new file mode 100644 index 00000000..7ad94f7a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigInt/unsignedRightShift.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-unsignedRightShift + +module.exports = function BigIntUnsignedRightShift(x, y) { + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts'); + } + + throw new $TypeError('BigInts have no unsigned right shift, use >> instead'); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BigIntBitwiseOp.js b/docs/snippets/node_modules/es-abstract/2021/BigIntBitwiseOp.js new file mode 100644 index 00000000..1af4cad8 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BigIntBitwiseOp.js @@ -0,0 +1,66 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +// var $BigInt = GetIntrinsic('%BigInt%', true); +// var $pow = GetIntrinsic('%Math.pow%'); + +// var BinaryAnd = require('./BinaryAnd'); +// var BinaryOr = require('./BinaryOr'); +// var BinaryXor = require('./BinaryXor'); +var Type = require('./Type'); +// var modulo = require('./modulo'); + +// var zero = $BigInt && $BigInt(0); +// var negOne = $BigInt && $BigInt(-1); +// var two = $BigInt && $BigInt(2); + +// https://262.ecma-international.org/11.0/#sec-bigintbitwiseop + +module.exports = function BigIntBitwiseOp(op, x, y) { + if (op !== '&' && op !== '|' && op !== '^') { + throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); + } + if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') { + throw new $TypeError('`x` and `y` must be BigInts'); + } + + if (op === '&') { + return x & y; + } + if (op === '|') { + return x | y; + } + return x ^ y; + /* + var result = zero; + var shift = 0; + while (x !== zero && x !== negOne && y !== zero && y !== negOne) { + var xDigit = modulo(x, two); + var yDigit = modulo(y, two); + if (op === '&') { + result += $pow(2, shift) * BinaryAnd(xDigit, yDigit); + } else if (op === '|') { + result += $pow(2, shift) * BinaryOr(xDigit, yDigit); + } else if (op === '^') { + result += $pow(2, shift) * BinaryXor(xDigit, yDigit); + } + shift += 1; + x = (x - xDigit) / two; + y = (y - yDigit) / two; + } + var tmp; + if (op === '&') { + tmp = BinaryAnd(modulo(x, two), modulo(y, two)); + } else if (op === '|') { + tmp = BinaryAnd(modulo(x, two), modulo(y, two)); + } else { + tmp = BinaryXor(modulo(x, two), modulo(y, two)); + } + if (tmp !== 0) { + result -= $pow(2, shift); + } + return result; + */ +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BinaryAnd.js b/docs/snippets/node_modules/es-abstract/2021/BinaryAnd.js new file mode 100644 index 00000000..c617f388 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BinaryAnd.js @@ -0,0 +1,14 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +// https://262.ecma-international.org/11.0/#sec-binaryand + +module.exports = function BinaryAnd(x, y) { + if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { + throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); + } + return x & y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BinaryOr.js b/docs/snippets/node_modules/es-abstract/2021/BinaryOr.js new file mode 100644 index 00000000..6de0955f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BinaryOr.js @@ -0,0 +1,14 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +// https://262.ecma-international.org/11.0/#sec-binaryor + +module.exports = function BinaryOr(x, y) { + if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { + throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); + } + return x | y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/BinaryXor.js b/docs/snippets/node_modules/es-abstract/2021/BinaryXor.js new file mode 100644 index 00000000..189d7d84 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/BinaryXor.js @@ -0,0 +1,14 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +// https://262.ecma-international.org/11.0/#sec-binaryxor + +module.exports = function BinaryXor(x, y) { + if ((x !== 0 && x !== 1) || (y !== 0 && y !== 1)) { + throw new $TypeError('Assertion failed: `x` and `y` must be either 0 or 1'); + } + return x ^ y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ByteListBitwiseOp.js b/docs/snippets/node_modules/es-abstract/2021/ByteListBitwiseOp.js new file mode 100644 index 00000000..4e3c1f10 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ByteListBitwiseOp.js @@ -0,0 +1,44 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var $push = callBound('Array.prototype.push'); + +var IsArray = require('./IsArray'); + +var isByteValue = require('../helpers/isByteValue'); + +// https://ecma-international.org/ecma-262/12.0/#sec-bytelistbitwiseop + +module.exports = function ByteListBitwiseOp(op, xBytes, yBytes) { + if (op !== '&' && op !== '^' && op !== '|') { + throw new $TypeError('Assertion failed: `op` must be `&`, `^`, or `|`'); + } + if (!IsArray(xBytes) || !IsArray(yBytes) || xBytes.length !== yBytes.length) { + throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be same-length sequences of byte values (an integer 0-255, inclusive)'); + } + + var result = []; + + for (var i = 0; i < xBytes.length; i += 1) { + var xByte = xBytes[i]; + var yByte = yBytes[i]; + if (!isByteValue(xByte) || !isByteValue(yByte)) { + throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be same-length sequences of byte values (an integer 0-255, inclusive)'); + } + var resultByte; + if (op === '&') { + resultByte = xByte & yByte; + } else if (op === '^') { + resultByte = xByte ^ yByte; + } else { + resultByte = xByte | yByte; + } + $push(result, resultByte); + } + + return result; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ByteListEqual.js b/docs/snippets/node_modules/es-abstract/2021/ByteListEqual.js new file mode 100644 index 00000000..adc2378e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ByteListEqual.js @@ -0,0 +1,33 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsArray = require('./IsArray'); + +var isByteValue = require('../helpers/isByteValue'); + +// https://ecma-international.org/ecma-262/12.0/#sec-bytelistequal + +module.exports = function ByteListEqual(xBytes, yBytes) { + if (!IsArray(xBytes) || !IsArray(yBytes)) { + throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)'); + } + + if (xBytes.length !== yBytes.length) { + return false; + } + + for (var i = 0; i < xBytes.length; i += 1) { + var xByte = xBytes[i]; + var yByte = yBytes[i]; + if (!isByteValue(xByte) || !isByteValue(yByte)) { + throw new $TypeError('Assertion failed: `xBytes` and `yBytes` must be sequences of byte values (an integer 0-255, inclusive)'); + } + if (xByte !== yByte) { + return false; + } + } + return true; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Call.js b/docs/snippets/node_modules/es-abstract/2021/Call.js new file mode 100644 index 00000000..4b238c69 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Call.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsArray = require('./IsArray'); + +var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%'); + +// https://ecma-international.org/ecma-262/6.0/#sec-call + +module.exports = function Call(F, V) { + var argumentsList = arguments.length > 2 ? arguments[2] : []; + if (!IsArray(argumentsList)) { + throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); + } + return $apply(F, V, argumentsList); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CanonicalNumericIndexString.js b/docs/snippets/node_modules/es-abstract/2021/CanonicalNumericIndexString.js new file mode 100644 index 00000000..feb878c0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CanonicalNumericIndexString.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var SameValue = require('./SameValue'); +var ToNumber = require('./ToNumber'); +var ToString = require('./ToString'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring + +module.exports = function CanonicalNumericIndexString(argument) { + if (Type(argument) !== 'String') { + throw new $TypeError('Assertion failed: `argument` must be a String'); + } + if (argument === '-0') { return -0; } + var n = ToNumber(argument); + if (SameValue(ToString(n), argument)) { return n; } + return void 0; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CharacterRange.js b/docs/snippets/node_modules/es-abstract/2021/CharacterRange.js new file mode 100644 index 00000000..70e4b523 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CharacterRange.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $charCodeAt = callBound('%String.prototype.charCodeAt%'); +var $push = callBound('%Array.prototype.push%'); + +module.exports = function CharacterRange(A, B) { + if (A.length !== 1 || B.length !== 1) { + throw new $TypeError('Assertion failed: CharSets A and B contain exactly one character'); + } + + var a = A[0]; + var b = B[0]; + + var i = $charCodeAt(a, 0); + var j = $charCodeAt(b, 0); + + if (!(i <= j)) { + throw new $TypeError('Assertion failed: i is not <= j'); + } + + var arr = []; + for (var k = i; k <= j; k += 1) { + $push(arr, $fromCharCode(k)); + } + return arr; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ClearKeptObjects.js b/docs/snippets/node_modules/es-abstract/2021/ClearKeptObjects.js new file mode 100644 index 00000000..9397f596 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ClearKeptObjects.js @@ -0,0 +1,12 @@ +'use strict'; + +var SLOT = require('internal-slot'); +var keptObjects = []; + +// https://ecma-international.org/ecma-262/12.0/#sec-clear-kept-objects + +module.exports = function ClearKeptObjects() { + keptObjects.length = 0; +}; + +SLOT.set(module.exports, '[[es-abstract internal: KeptAlive]]', keptObjects); diff --git a/docs/snippets/node_modules/es-abstract/2021/CodePointAt.js b/docs/snippets/node_modules/es-abstract/2021/CodePointAt.js new file mode 100644 index 00000000..7a9ac1be --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CodePointAt.js @@ -0,0 +1,58 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var callBound = require('call-bind/callBound'); +var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); +var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); + +var Type = require('./Type'); +var UTF16SurrogatePairToCodePoint = require('./UTF16SurrogatePairToCodePoint'); + +var $charAt = callBound('String.prototype.charAt'); +var $charCodeAt = callBound('String.prototype.charCodeAt'); + +// https://ecma-international.org/ecma-262/12.0/#sec-codepointat + +module.exports = function CodePointAt(string, position) { + if (Type(string) !== 'String') { + throw new $TypeError('Assertion failed: `string` must be a String'); + } + var size = string.length; + if (position < 0 || position >= size) { + throw new $TypeError('Assertion failed: `position` must be >= 0, and < the length of `string`'); + } + var first = $charCodeAt(string, position); + var cp = $charAt(string, position); + var firstIsLeading = isLeadingSurrogate(first); + var firstIsTrailing = isTrailingSurrogate(first); + if (!firstIsLeading && !firstIsTrailing) { + return { + '[[CodePoint]]': cp, + '[[CodeUnitCount]]': 1, + '[[IsUnpairedSurrogate]]': false + }; + } + if (firstIsTrailing || (position + 1 === size)) { + return { + '[[CodePoint]]': cp, + '[[CodeUnitCount]]': 1, + '[[IsUnpairedSurrogate]]': true + }; + } + var second = $charCodeAt(string, position + 1); + if (!isTrailingSurrogate(second)) { + return { + '[[CodePoint]]': cp, + '[[CodeUnitCount]]': 1, + '[[IsUnpairedSurrogate]]': true + }; + } + + return { + '[[CodePoint]]': UTF16SurrogatePairToCodePoint(first, second), + '[[CodeUnitCount]]': 2, + '[[IsUnpairedSurrogate]]': false + }; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CodePointsToString.js b/docs/snippets/node_modules/es-abstract/2021/CodePointsToString.js new file mode 100644 index 00000000..403126cd --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CodePointsToString.js @@ -0,0 +1,27 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint'); +var IsArray = require('./IsArray'); + +var forEach = require('../helpers/forEach'); +var isCodePoint = require('../helpers/isCodePoint'); + +// https://ecma-international.org/ecma-262/12.0/#sec-codepointstostring + +module.exports = function CodePointsToString(text) { + if (!IsArray(text)) { + throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points'); + } + var result = ''; + forEach(text, function (cp) { + if (!isCodePoint(cp)) { + throw new $TypeError('Assertion failed: `text` must be a sequence of Unicode Code Points'); + } + result += UTF16EncodeCodePoint(cp); + }); + return result; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CompletePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/CompletePropertyDescriptor.js new file mode 100644 index 00000000..548bf415 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CompletePropertyDescriptor.js @@ -0,0 +1,39 @@ +'use strict'; + +var has = require('has'); + +var assertRecord = require('../helpers/assertRecord'); + +var IsDataDescriptor = require('./IsDataDescriptor'); +var IsGenericDescriptor = require('./IsGenericDescriptor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor + +module.exports = function CompletePropertyDescriptor(Desc) { + /* eslint no-param-reassign: 0 */ + assertRecord(Type, 'Property Descriptor', 'Desc', Desc); + + if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { + if (!has(Desc, '[[Value]]')) { + Desc['[[Value]]'] = void 0; + } + if (!has(Desc, '[[Writable]]')) { + Desc['[[Writable]]'] = false; + } + } else { + if (!has(Desc, '[[Get]]')) { + Desc['[[Get]]'] = void 0; + } + if (!has(Desc, '[[Set]]')) { + Desc['[[Set]]'] = void 0; + } + } + if (!has(Desc, '[[Enumerable]]')) { + Desc['[[Enumerable]]'] = false; + } + if (!has(Desc, '[[Configurable]]')) { + Desc['[[Configurable]]'] = false; + } + return Desc; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CopyDataProperties.js b/docs/snippets/node_modules/es-abstract/2021/CopyDataProperties.js new file mode 100644 index 00000000..1b0c7df2 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CopyDataProperties.js @@ -0,0 +1,70 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); +var forEach = require('../helpers/forEach'); +var every = require('../helpers/every'); +var some = require('../helpers/some'); +var OwnPropertyKeys = require('../helpers/OwnPropertyKeys'); + +var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); + +var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); +var Get = require('./Get'); +var IsArray = require('./IsArray'); +var IsIntegralNumber = require('./IsIntegralNumber'); +var IsPropertyKey = require('./IsPropertyKey'); +var SameValue = require('./SameValue'); +var ToNumber = require('./ToNumber'); +var ToObject = require('./ToObject'); +var Type = require('./Type'); + +// https://www.ecma-international.org/ecma-262/12.0/#sec-copydataproperties + +module.exports = function CopyDataProperties(target, source, excludedItems) { + if (Type(target) !== 'Object') { + throw new $TypeError('Assertion failed: "target" must be an Object'); + } + + if (!IsArray(excludedItems) || !every(excludedItems, IsPropertyKey)) { + throw new $TypeError('Assertion failed: "excludedItems" must be a List of Property Keys'); + } + + if (typeof source === 'undefined' || source === null) { + return target; + } + + var from = ToObject(source); + + var keys = OwnPropertyKeys(from); + forEach(keys, function (nextKey) { + var excluded = some(excludedItems, function (e) { + return SameValue(e, nextKey) === true; + }); + /* + var excluded = false; + + forEach(excludedItems, function (e) { + if (SameValue(e, nextKey) === true) { + excluded = true; + } + }); + */ + + var enumerable = $isEnumerable(from, nextKey) || ( + // this is to handle string keys being non-enumerable in older engines + typeof source === 'string' + && nextKey >= 0 + && IsIntegralNumber(ToNumber(nextKey)) + ); + if (excluded === false && enumerable) { + var propValue = Get(from, nextKey); + CreateDataPropertyOrThrow(target, nextKey, propValue); + } + }); + + return target; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CreateDataProperty.js b/docs/snippets/node_modules/es-abstract/2021/CreateDataProperty.js new file mode 100644 index 00000000..ff5ca305 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CreateDataProperty.js @@ -0,0 +1,45 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var DefineOwnProperty = require('../helpers/DefineOwnProperty'); + +var FromPropertyDescriptor = require('./FromPropertyDescriptor'); +var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty'); +var IsDataDescriptor = require('./IsDataDescriptor'); +var IsExtensible = require('./IsExtensible'); +var IsPropertyKey = require('./IsPropertyKey'); +var SameValue = require('./SameValue'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty + +module.exports = function CreateDataProperty(O, P, V) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + var oldDesc = OrdinaryGetOwnProperty(O, P); + var extensible = !oldDesc || IsExtensible(O); + var immutable = oldDesc && (!oldDesc['[[Writable]]'] || !oldDesc['[[Configurable]]']); + if (immutable || !extensible) { + return false; + } + return DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + { + '[[Configurable]]': true, + '[[Enumerable]]': true, + '[[Value]]': V, + '[[Writable]]': true + } + ); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CreateDataPropertyOrThrow.js b/docs/snippets/node_modules/es-abstract/2021/CreateDataPropertyOrThrow.js new file mode 100644 index 00000000..2f7c410b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CreateDataPropertyOrThrow.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var CreateDataProperty = require('./CreateDataProperty'); +var IsPropertyKey = require('./IsPropertyKey'); +var Type = require('./Type'); + +// // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow + +module.exports = function CreateDataPropertyOrThrow(O, P, V) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + var success = CreateDataProperty(O, P, V); + if (!success) { + throw new $TypeError('unable to create data property'); + } + return success; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CreateHTML.js b/docs/snippets/node_modules/es-abstract/2021/CreateHTML.js new file mode 100644 index 00000000..ccded1e6 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CreateHTML.js @@ -0,0 +1,30 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); + +var $replace = callBound('String.prototype.replace'); + +var RequireObjectCoercible = require('./RequireObjectCoercible'); +var ToString = require('./ToString'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-createhtml + +module.exports = function CreateHTML(string, tag, attribute, value) { + if (Type(tag) !== 'String' || Type(attribute) !== 'String') { + throw new $TypeError('Assertion failed: `tag` and `attribute` must be strings'); + } + var str = RequireObjectCoercible(string); + var S = ToString(str); + var p1 = '<' + tag; + if (attribute !== '') { + var V = ToString(value); + var escapedV = $replace(V, /\x22/g, '"'); + p1 += '\x20' + attribute + '\x3D\x22' + escapedV + '\x22'; + } + return p1 + '>' + S + ''; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CreateIterResultObject.js b/docs/snippets/node_modules/es-abstract/2021/CreateIterResultObject.js new file mode 100644 index 00000000..eea77a51 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CreateIterResultObject.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject + +module.exports = function CreateIterResultObject(value, done) { + if (Type(done) !== 'Boolean') { + throw new $TypeError('Assertion failed: Type(done) is not Boolean'); + } + return { + value: value, + done: done + }; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CreateListFromArrayLike.js b/docs/snippets/node_modules/es-abstract/2021/CreateListFromArrayLike.js new file mode 100644 index 00000000..3e9f5f40 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CreateListFromArrayLike.js @@ -0,0 +1,44 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBound = require('call-bind/callBound'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $indexOf = callBound('Array.prototype.indexOf', true) || callBound('String.prototype.indexOf'); +var $push = callBound('Array.prototype.push'); + +var Get = require('./Get'); +var IsArray = require('./IsArray'); +var LengthOfArrayLike = require('./LengthOfArrayLike'); +var ToString = require('./ToString'); +var Type = require('./Type'); + +// https://262.ecma-international.org/11.0/#sec-createlistfromarraylike + +module.exports = function CreateListFromArrayLike(obj) { + var elementTypes = arguments.length > 1 + ? arguments[1] + : ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object']; + + if (Type(obj) !== 'Object') { + throw new $TypeError('Assertion failed: `obj` must be an Object'); + } + if (!IsArray(elementTypes)) { + throw new $TypeError('Assertion failed: `elementTypes`, if provided, must be an array'); + } + var len = LengthOfArrayLike(obj); + var list = []; + var index = 0; + while (index < len) { + var indexName = ToString(index); + var next = Get(obj, indexName); + var nextType = Type(next); + if ($indexOf(elementTypes, nextType) < 0) { + throw new $TypeError('item type ' + nextType + ' is not a valid elementType'); + } + $push(list, next); + index += 1; + } + return list; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CreateMethodProperty.js b/docs/snippets/node_modules/es-abstract/2021/CreateMethodProperty.js new file mode 100644 index 00000000..53274a56 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CreateMethodProperty.js @@ -0,0 +1,40 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var DefineOwnProperty = require('../helpers/DefineOwnProperty'); + +var FromPropertyDescriptor = require('./FromPropertyDescriptor'); +var IsDataDescriptor = require('./IsDataDescriptor'); +var IsPropertyKey = require('./IsPropertyKey'); +var SameValue = require('./SameValue'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty + +module.exports = function CreateMethodProperty(O, P, V) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + + var newDesc = { + '[[Configurable]]': true, + '[[Enumerable]]': false, + '[[Value]]': V, + '[[Writable]]': true + }; + return DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + newDesc + ); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/CreateRegExpStringIterator.js b/docs/snippets/node_modules/es-abstract/2021/CreateRegExpStringIterator.js new file mode 100644 index 00000000..dd493e48 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/CreateRegExpStringIterator.js @@ -0,0 +1,111 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var hasSymbols = require('has-symbols')(); + +var $TypeError = GetIntrinsic('%TypeError%'); +var IteratorPrototype = GetIntrinsic('%IteratorPrototype%', true); +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); + +var AdvanceStringIndex = require('./AdvanceStringIndex'); +var CreateIterResultObject = require('./CreateIterResultObject'); +var CreateMethodProperty = require('./CreateMethodProperty'); +var Get = require('./Get'); +var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); +var RegExpExec = require('./RegExpExec'); +var Set = require('./Set'); +var ToLength = require('./ToLength'); +var ToString = require('./ToString'); +var Type = require('./Type'); + +var SLOT = require('internal-slot'); + +var RegExpStringIterator = function RegExpStringIterator(R, S, global, fullUnicode) { + if (Type(S) !== 'String') { + throw new $TypeError('`S` must be a string'); + } + if (Type(global) !== 'Boolean') { + throw new $TypeError('`global` must be a boolean'); + } + if (Type(fullUnicode) !== 'Boolean') { + throw new $TypeError('`fullUnicode` must be a boolean'); + } + SLOT.set(this, '[[IteratingRegExp]]', R); + SLOT.set(this, '[[IteratedString]]', S); + SLOT.set(this, '[[Global]]', global); + SLOT.set(this, '[[Unicode]]', fullUnicode); + SLOT.set(this, '[[Done]]', false); +}; + +if (IteratorPrototype) { + RegExpStringIterator.prototype = OrdinaryObjectCreate(IteratorPrototype); +} + +var RegExpStringIteratorNext = function next() { + var O = this; // eslint-disable-line no-invalid-this + if (Type(O) !== 'Object') { + throw new $TypeError('receiver must be an object'); + } + if ( + !(O instanceof RegExpStringIterator) + || !SLOT.has(O, '[[IteratingRegExp]]') + || !SLOT.has(O, '[[IteratedString]]') + || !SLOT.has(O, '[[Global]]') + || !SLOT.has(O, '[[Unicode]]') + || !SLOT.has(O, '[[Done]]') + ) { + throw new $TypeError('"this" value must be a RegExpStringIterator instance'); + } + if (SLOT.get(O, '[[Done]]')) { + return CreateIterResultObject(undefined, true); + } + var R = SLOT.get(O, '[[IteratingRegExp]]'); + var S = SLOT.get(O, '[[IteratedString]]'); + var global = SLOT.get(O, '[[Global]]'); + var fullUnicode = SLOT.get(O, '[[Unicode]]'); + var match = RegExpExec(R, S); + if (match === null) { + SLOT.set(O, '[[Done]]', true); + return CreateIterResultObject(undefined, true); + } + if (global) { + var matchStr = ToString(Get(match, '0')); + if (matchStr === '') { + var thisIndex = ToLength(Get(R, 'lastIndex')); + var nextIndex = AdvanceStringIndex(S, thisIndex, fullUnicode); + Set(R, 'lastIndex', nextIndex, true); + } + return CreateIterResultObject(match, false); + } + SLOT.set(O, '[[Done]]', true); + return CreateIterResultObject(match, false); +}; +CreateMethodProperty(RegExpStringIterator.prototype, 'next', RegExpStringIteratorNext); + +if (hasSymbols) { + if (Symbol.toStringTag) { + if ($defineProperty) { + $defineProperty(RegExpStringIterator.prototype, Symbol.toStringTag, { + configurable: true, + enumerable: false, + value: 'RegExp String Iterator', + writable: false + }); + } else { + RegExpStringIterator.prototype[Symbol.toStringTag] = 'RegExp String Iterator'; + } + } + + if (Symbol.iterator && typeof RegExpStringIterator.prototype[Symbol.iterator] !== 'function') { + var iteratorFn = function SymbolIterator() { + return this; + }; + CreateMethodProperty(RegExpStringIterator.prototype, Symbol.iterator, iteratorFn); + } +} + +// https://262.ecma-international.org/11.0/#sec-createregexpstringiterator +module.exports = function CreateRegExpStringIterator(R, S, global, fullUnicode) { + // assert R.global === global && R.unicode === fullUnicode? + return new RegExpStringIterator(R, S, global, fullUnicode); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/DateFromTime.js b/docs/snippets/node_modules/es-abstract/2021/DateFromTime.js new file mode 100644 index 00000000..20e4f2e4 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/DateFromTime.js @@ -0,0 +1,54 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $EvalError = GetIntrinsic('%EvalError%'); + +var DayWithinYear = require('./DayWithinYear'); +var InLeapYear = require('./InLeapYear'); +var MonthFromTime = require('./MonthFromTime'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.5 + +module.exports = function DateFromTime(t) { + var m = MonthFromTime(t); + var d = DayWithinYear(t); + if (m === 0) { + return d + 1; + } + if (m === 1) { + return d - 30; + } + var leap = InLeapYear(t); + if (m === 2) { + return d - 58 - leap; + } + if (m === 3) { + return d - 89 - leap; + } + if (m === 4) { + return d - 119 - leap; + } + if (m === 5) { + return d - 150 - leap; + } + if (m === 6) { + return d - 180 - leap; + } + if (m === 7) { + return d - 211 - leap; + } + if (m === 8) { + return d - 242 - leap; + } + if (m === 9) { + return d - 272 - leap; + } + if (m === 10) { + return d - 303 - leap; + } + if (m === 11) { + return d - 333 - leap; + } + throw new $EvalError('Assertion failed: MonthFromTime returned an impossible value: ' + m); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/DateString.js b/docs/snippets/node_modules/es-abstract/2021/DateString.js new file mode 100644 index 00000000..939c14c0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/DateString.js @@ -0,0 +1,30 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + +var $isNaN = require('../helpers/isNaN'); +var padTimeComponent = require('../helpers/padTimeComponent'); + +var Type = require('./Type'); +var WeekDay = require('./WeekDay'); +var MonthFromTime = require('./MonthFromTime'); +var YearFromTime = require('./YearFromTime'); +var DateFromTime = require('./DateFromTime'); + +// https://262.ecma-international.org/9.0/#sec-datestring + +module.exports = function DateString(tv) { + if (Type(tv) !== 'Number' || $isNaN(tv)) { + throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); + } + var weekday = weekdays[WeekDay(tv)]; + var month = months[MonthFromTime(tv)]; + var day = padTimeComponent(DateFromTime(tv)); + var year = padTimeComponent(YearFromTime(tv), 4); + return weekday + '\x20' + month + '\x20' + day + '\x20' + year; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Day.js b/docs/snippets/node_modules/es-abstract/2021/Day.js new file mode 100644 index 00000000..51d01033 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Day.js @@ -0,0 +1,11 @@ +'use strict'; + +var floor = require('./floor'); + +var msPerDay = require('../helpers/timeConstants').msPerDay; + +// https://262.ecma-international.org/5.1/#sec-15.9.1.2 + +module.exports = function Day(t) { + return floor(t / msPerDay); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/DayFromYear.js b/docs/snippets/node_modules/es-abstract/2021/DayFromYear.js new file mode 100644 index 00000000..341bf22a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/DayFromYear.js @@ -0,0 +1,10 @@ +'use strict'; + +var floor = require('./floor'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.3 + +module.exports = function DayFromYear(y) { + return (365 * (y - 1970)) + floor((y - 1969) / 4) - floor((y - 1901) / 100) + floor((y - 1601) / 400); +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/DayWithinYear.js b/docs/snippets/node_modules/es-abstract/2021/DayWithinYear.js new file mode 100644 index 00000000..4c580940 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/DayWithinYear.js @@ -0,0 +1,11 @@ +'use strict'; + +var Day = require('./Day'); +var DayFromYear = require('./DayFromYear'); +var YearFromTime = require('./YearFromTime'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.4 + +module.exports = function DayWithinYear(t) { + return Day(t) - DayFromYear(YearFromTime(t)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/DaysInYear.js b/docs/snippets/node_modules/es-abstract/2021/DaysInYear.js new file mode 100644 index 00000000..7116c690 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/DaysInYear.js @@ -0,0 +1,18 @@ +'use strict'; + +var modulo = require('./modulo'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.3 + +module.exports = function DaysInYear(y) { + if (modulo(y, 4) !== 0) { + return 365; + } + if (modulo(y, 100) !== 0) { + return 366; + } + if (modulo(y, 400) !== 0) { + return 365; + } + return 366; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/DefinePropertyOrThrow.js b/docs/snippets/node_modules/es-abstract/2021/DefinePropertyOrThrow.js new file mode 100644 index 00000000..26f2714b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/DefinePropertyOrThrow.js @@ -0,0 +1,50 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); +var DefineOwnProperty = require('../helpers/DefineOwnProperty'); + +var FromPropertyDescriptor = require('./FromPropertyDescriptor'); +var IsAccessorDescriptor = require('./IsAccessorDescriptor'); +var IsDataDescriptor = require('./IsDataDescriptor'); +var IsPropertyKey = require('./IsPropertyKey'); +var SameValue = require('./SameValue'); +var ToPropertyDescriptor = require('./ToPropertyDescriptor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow + +module.exports = function DefinePropertyOrThrow(O, P, desc) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + + var Desc = isPropertyDescriptor({ + Type: Type, + IsDataDescriptor: IsDataDescriptor, + IsAccessorDescriptor: IsAccessorDescriptor + }, desc) ? desc : ToPropertyDescriptor(desc); + if (!isPropertyDescriptor({ + Type: Type, + IsDataDescriptor: IsDataDescriptor, + IsAccessorDescriptor: IsAccessorDescriptor + }, Desc)) { + throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor'); + } + + return DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + Desc + ); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/DeletePropertyOrThrow.js b/docs/snippets/node_modules/es-abstract/2021/DeletePropertyOrThrow.js new file mode 100644 index 00000000..30d5e57c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/DeletePropertyOrThrow.js @@ -0,0 +1,27 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsPropertyKey = require('./IsPropertyKey'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow + +module.exports = function DeletePropertyOrThrow(O, P) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + + // eslint-disable-next-line no-param-reassign + var success = delete O[P]; + if (!success) { + throw new $TypeError('Attempt to delete property failed.'); + } + return success; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/EnumerableOwnPropertyNames.js b/docs/snippets/node_modules/es-abstract/2021/EnumerableOwnPropertyNames.js new file mode 100644 index 00000000..44171b9e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/EnumerableOwnPropertyNames.js @@ -0,0 +1,43 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var objectKeys = require('object-keys'); + +var callBound = require('call-bind/callBound'); + +var callBind = require('call-bind'); + +var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); +var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%')); + +var forEach = require('../helpers/forEach'); + +var Type = require('./Type'); + +// https://262.ecma-international.org/8.0/#sec-enumerableownproperties + +module.exports = function EnumerableOwnProperties(O, kind) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + var keys = objectKeys(O); + if (kind === 'key') { + return keys; + } + if (kind === 'value' || kind === 'key+value') { + var results = []; + forEach(keys, function (key) { + if ($isEnumerable(O, key)) { + $pushApply(results, [ + kind === 'value' ? O[key] : [key, O[key]] + ]); + } + }); + return results; + } + throw new $TypeError('Assertion failed: "kind" is not "key", "value", or "key+value": ' + kind); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/FlattenIntoArray.js b/docs/snippets/node_modules/es-abstract/2021/FlattenIntoArray.js new file mode 100644 index 00000000..6429ee79 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/FlattenIntoArray.js @@ -0,0 +1,58 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); + +var Call = require('./Call'); +var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow'); +var Get = require('./Get'); +var HasProperty = require('./HasProperty'); +var IsArray = require('./IsArray'); +var LengthOfArrayLike = require('./LengthOfArrayLike'); +var ToString = require('./ToString'); + +// https://262.ecma-international.org/11.0/#sec-flattenintoarray + +// eslint-disable-next-line max-params +module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) { + var mapperFunction; + if (arguments.length > 5) { + mapperFunction = arguments[5]; + } + + var targetIndex = start; + var sourceIndex = 0; + while (sourceIndex < sourceLen) { + var P = ToString(sourceIndex); + var exists = HasProperty(source, P); + if (exists === true) { + var element = Get(source, P); + if (typeof mapperFunction !== 'undefined') { + if (arguments.length <= 6) { + throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided'); + } + element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]); + } + var shouldFlatten = false; + if (depth > 0) { + shouldFlatten = IsArray(element); + } + if (shouldFlatten) { + var elementLen = LengthOfArrayLike(element); + targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1); + } else { + if (targetIndex >= MAX_SAFE_INTEGER) { + throw new $TypeError('index too large'); + } + CreateDataPropertyOrThrow(target, ToString(targetIndex), element); + targetIndex += 1; + } + } + sourceIndex += 1; + } + + return targetIndex; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/FromPropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/FromPropertyDescriptor.js new file mode 100644 index 00000000..9a69a260 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/FromPropertyDescriptor.js @@ -0,0 +1,36 @@ +'use strict'; + +var assertRecord = require('../helpers/assertRecord'); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor + +module.exports = function FromPropertyDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return Desc; + } + + assertRecord(Type, 'Property Descriptor', 'Desc', Desc); + + var obj = {}; + if ('[[Value]]' in Desc) { + obj.value = Desc['[[Value]]']; + } + if ('[[Writable]]' in Desc) { + obj.writable = Desc['[[Writable]]']; + } + if ('[[Get]]' in Desc) { + obj.get = Desc['[[Get]]']; + } + if ('[[Set]]' in Desc) { + obj.set = Desc['[[Set]]']; + } + if ('[[Enumerable]]' in Desc) { + obj.enumerable = Desc['[[Enumerable]]']; + } + if ('[[Configurable]]' in Desc) { + obj.configurable = Desc['[[Configurable]]']; + } + return obj; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Get.js b/docs/snippets/node_modules/es-abstract/2021/Get.js new file mode 100644 index 00000000..681055a2 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Get.js @@ -0,0 +1,30 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var inspect = require('object-inspect'); + +var IsPropertyKey = require('./IsPropertyKey'); +var Type = require('./Type'); + +/** + * 7.3.1 Get (O, P) - https://ecma-international.org/ecma-262/6.0/#sec-get-o-p + * 1. Assert: Type(O) is Object. + * 2. Assert: IsPropertyKey(P) is true. + * 3. Return O.[[Get]](P, O). + */ + +module.exports = function Get(O, P) { + // 7.3.1.1 + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + // 7.3.1.2 + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P)); + } + // 7.3.1.3 + return O[P]; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/GetIterator.js b/docs/snippets/node_modules/es-abstract/2021/GetIterator.js new file mode 100644 index 00000000..0e74c173 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/GetIterator.js @@ -0,0 +1,65 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $asyncIterator = GetIntrinsic('%Symbol.asyncIterator%', true); + +var inspect = require('object-inspect'); +var hasSymbols = require('has-symbols')(); + +var getIteratorMethod = require('../helpers/getIteratorMethod'); +var AdvanceStringIndex = require('./AdvanceStringIndex'); +var Call = require('./Call'); +var GetMethod = require('./GetMethod'); +var IsArray = require('./IsArray'); +var Type = require('./Type'); + +// https://262.ecma-international.org/9.0/#sec-getiterator +module.exports = function GetIterator(obj, hint, method) { + var actualHint = hint; + if (arguments.length < 2) { + actualHint = 'sync'; + } + if (actualHint !== 'sync' && actualHint !== 'async') { + throw new $TypeError("Assertion failed: `hint` must be one of 'sync' or 'async', got " + inspect(hint)); + } + + var actualMethod = method; + if (arguments.length < 3) { + if (actualHint === 'async') { + if (hasSymbols && $asyncIterator) { + actualMethod = GetMethod(obj, $asyncIterator); + } + if (actualMethod === undefined) { + throw new $TypeError("async from sync iterators aren't currently supported"); + } + } else { + actualMethod = getIteratorMethod( + { + AdvanceStringIndex: AdvanceStringIndex, + GetMethod: GetMethod, + IsArray: IsArray, + Type: Type + }, + obj + ); + } + } + var iterator = Call(actualMethod, obj); + if (Type(iterator) !== 'Object') { + throw new $TypeError('iterator must return an object'); + } + + return iterator; + + // TODO: This should return an IteratorRecord + /* + var nextMethod = GetV(iterator, 'next'); + return { + '[[Iterator]]': iterator, + '[[NextMethod]]': nextMethod, + '[[Done]]': false + }; + */ +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/GetMethod.js b/docs/snippets/node_modules/es-abstract/2021/GetMethod.js new file mode 100644 index 00000000..775d3fb9 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/GetMethod.js @@ -0,0 +1,42 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var GetV = require('./GetV'); +var IsCallable = require('./IsCallable'); +var IsPropertyKey = require('./IsPropertyKey'); + +/** + * 7.3.9 - https://ecma-international.org/ecma-262/6.0/#sec-getmethod + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let func be GetV(O, P). + * 3. ReturnIfAbrupt(func). + * 4. If func is either undefined or null, return undefined. + * 5. If IsCallable(func) is false, throw a TypeError exception. + * 6. Return func. + */ + +module.exports = function GetMethod(O, P) { + // 7.3.9.1 + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + + // 7.3.9.2 + var func = GetV(O, P); + + // 7.3.9.4 + if (func == null) { + return void 0; + } + + // 7.3.9.5 + if (!IsCallable(func)) { + throw new $TypeError(P + 'is not a function'); + } + + // 7.3.9.6 + return func; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/GetOwnPropertyKeys.js b/docs/snippets/node_modules/es-abstract/2021/GetOwnPropertyKeys.js new file mode 100644 index 00000000..b8f4167f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/GetOwnPropertyKeys.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var hasSymbols = require('has-symbols')(); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%'); +var $gOPS = hasSymbols && GetIntrinsic('%Object.getOwnPropertySymbols%'); +var keys = require('object-keys'); + +var esType = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys + +module.exports = function GetOwnPropertyKeys(O, Type) { + if (esType(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (Type === 'Symbol') { + return $gOPS ? $gOPS(O) : []; + } + if (Type === 'String') { + if (!$gOPN) { + return keys(O); + } + return $gOPN(O); + } + throw new $TypeError('Assertion failed: `Type` must be `"String"` or `"Symbol"`'); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/GetPromiseResolve.js b/docs/snippets/node_modules/es-abstract/2021/GetPromiseResolve.js new file mode 100644 index 00000000..6efc1028 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/GetPromiseResolve.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var IsConstructor = require('./IsConstructor'); + +// https://ecma-international.org/ecma-262/12.0/#sec-getpromiseresolve + +module.exports = function GetPromiseResolve(promiseConstructor) { + if (!IsConstructor(promiseConstructor)) { + throw new $TypeError('Assertion failed: `promiseConstructor` must be a constructor'); + } + var promiseResolve = Get(promiseConstructor, 'resolve'); + if (IsCallable(promiseResolve) === false) { + throw new $TypeError('`resolve` method is not callable'); + } + return promiseResolve; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/GetPrototypeFromConstructor.js b/docs/snippets/node_modules/es-abstract/2021/GetPrototypeFromConstructor.js new file mode 100644 index 00000000..5f369cad --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/GetPrototypeFromConstructor.js @@ -0,0 +1,28 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Function = GetIntrinsic('%Function%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Get = require('./Get'); +var IsConstructor = require('./IsConstructor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor + +module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) { + var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic + if (!IsConstructor(constructor)) { + throw new $TypeError('Assertion failed: `constructor` must be a constructor'); + } + var proto = Get(constructor, 'prototype'); + if (Type(proto) !== 'Object') { + if (!(constructor instanceof $Function)) { + // ignore other realms, for now + throw new $TypeError('cross-realm constructors not currently supported'); + } + proto = intrinsic; + } + return proto; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/GetSubstitution.js b/docs/snippets/node_modules/es-abstract/2021/GetSubstitution.js new file mode 100644 index 00000000..079687e9 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/GetSubstitution.js @@ -0,0 +1,128 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); +var regexTester = require('../helpers/regexTester'); +var every = require('../helpers/every'); + +var $charAt = callBound('String.prototype.charAt'); +var $strSlice = callBound('String.prototype.slice'); +var $indexOf = callBound('String.prototype.indexOf'); +var $parseInt = parseInt; + +var isDigit = regexTester(/^[0-9]$/); + +var inspect = require('object-inspect'); + +var Get = require('./Get'); +var IsArray = require('./IsArray'); +var IsIntegralNumber = require('./IsIntegralNumber'); +var ToObject = require('./ToObject'); +var ToString = require('./ToString'); +var Type = require('./Type'); + +var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false + +var isStringOrHole = function (capture, index, arr) { + return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined'); +}; + +// http://www.ecma-international.org/ecma-262/12.0/#sec-getsubstitution + +// eslint-disable-next-line max-statements, max-params, max-lines-per-function +module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) { + if (Type(matched) !== 'String') { + throw new $TypeError('Assertion failed: `matched` must be a String'); + } + var matchLength = matched.length; + + if (Type(str) !== 'String') { + throw new $TypeError('Assertion failed: `str` must be a String'); + } + var stringLength = str.length; + + if (!IsIntegralNumber(position) || position < 0 || position > stringLength) { + throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position)); + } + + if (!IsArray(captures) || !every(captures, isStringOrHole)) { + throw new $TypeError('Assertion failed: `captures` must be a possibly-empty List of Strings, got ' + inspect(captures)); + } + + if (Type(replacement) !== 'String') { + throw new $TypeError('Assertion failed: `replacement` must be a String'); + } + + var tailPos = position + matchLength; + var m = captures.length; + if (Type(namedCaptures) !== 'Undefined') { + namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign + } + + var result = ''; + for (var i = 0; i < replacement.length; i += 1) { + // if this is a $, and it's not the end of the replacement + var current = $charAt(replacement, i); + var isLast = (i + 1) >= replacement.length; + var nextIsLast = (i + 2) >= replacement.length; + if (current === '$' && !isLast) { + var next = $charAt(replacement, i + 1); + if (next === '$') { + result += '$'; + i += 1; + } else if (next === '&') { + result += matched; + i += 1; + } else if (next === '`') { + result += position === 0 ? '' : $strSlice(str, 0, position - 1); + i += 1; + } else if (next === "'") { + result += tailPos >= stringLength ? '' : $strSlice(str, tailPos); + i += 1; + } else { + var nextNext = nextIsLast ? null : $charAt(replacement, i + 2); + if (isDigit(next) && next !== '0' && (nextIsLast || !isDigit(nextNext))) { + // $1 through $9, and not followed by a digit + var n = $parseInt(next, 10); + // if (n > m, impl-defined) + result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1]; + i += 1; + } else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) { + // $00 through $99 + var nn = next + nextNext; + var nnI = $parseInt(nn, 10) - 1; + // if nn === '00' or nn > m, impl-defined + result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI]; + i += 2; + } else if (next === '<') { + // eslint-disable-next-line max-depth + if (Type(namedCaptures) === 'Undefined') { + result += '$<'; + i += 2; + } else { + var endIndex = $indexOf(replacement, '>', i); + // eslint-disable-next-line max-depth + if (endIndex > -1) { + var groupName = $strSlice(replacement, i + '$<'.length, endIndex); + var capture = Get(namedCaptures, groupName); + // eslint-disable-next-line max-depth + if (Type(capture) !== 'Undefined') { + result += ToString(capture); + } + i += ('<' + groupName + '>').length; + } + } + } else { + result += '$'; + } + } + } else { + // the final $, or else not a $ + result += $charAt(replacement, i); + } + } + return result; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/GetV.js b/docs/snippets/node_modules/es-abstract/2021/GetV.js new file mode 100644 index 00000000..2d8cc824 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/GetV.js @@ -0,0 +1,29 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsPropertyKey = require('./IsPropertyKey'); +var ToObject = require('./ToObject'); + +/** + * 7.3.2 GetV (V, P) + * 1. Assert: IsPropertyKey(P) is true. + * 2. Let O be ToObject(V). + * 3. ReturnIfAbrupt(O). + * 4. Return O.[[Get]](P, V). + */ + +module.exports = function GetV(V, P) { + // 7.3.2.1 + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + + // 7.3.2.2-3 + var O = ToObject(V); + + // 7.3.2.4 + return O[P]; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/HasOwnProperty.js b/docs/snippets/node_modules/es-abstract/2021/HasOwnProperty.js new file mode 100644 index 00000000..04d28495 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/HasOwnProperty.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var has = require('has'); + +var IsPropertyKey = require('./IsPropertyKey'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty + +module.exports = function HasOwnProperty(O, P) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: `O` must be an Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: `P` must be a Property Key'); + } + return has(O, P); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/HasProperty.js b/docs/snippets/node_modules/es-abstract/2021/HasProperty.js new file mode 100644 index 00000000..b341654e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/HasProperty.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsPropertyKey = require('./IsPropertyKey'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-hasproperty + +module.exports = function HasProperty(O, P) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: `O` must be an Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: `P` must be a Property Key'); + } + return P in O; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/HourFromTime.js b/docs/snippets/node_modules/es-abstract/2021/HourFromTime.js new file mode 100644 index 00000000..f963bfb6 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/HourFromTime.js @@ -0,0 +1,14 @@ +'use strict'; + +var floor = require('./floor'); +var modulo = require('./modulo'); + +var timeConstants = require('../helpers/timeConstants'); +var msPerHour = timeConstants.msPerHour; +var HoursPerDay = timeConstants.HoursPerDay; + +// https://262.ecma-international.org/5.1/#sec-15.9.1.10 + +module.exports = function HourFromTime(t) { + return modulo(floor(t / msPerHour), HoursPerDay); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/InLeapYear.js b/docs/snippets/node_modules/es-abstract/2021/InLeapYear.js new file mode 100644 index 00000000..bfe0c451 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/InLeapYear.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $EvalError = GetIntrinsic('%EvalError%'); + +var DaysInYear = require('./DaysInYear'); +var YearFromTime = require('./YearFromTime'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.3 + +module.exports = function InLeapYear(t) { + var days = DaysInYear(YearFromTime(t)); + if (days === 365) { + return 0; + } + if (days === 366) { + return 1; + } + throw new $EvalError('Assertion failed: there are not 365 or 366 days in a year, got: ' + days); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/InstanceofOperator.js b/docs/snippets/node_modules/es-abstract/2021/InstanceofOperator.js new file mode 100644 index 00000000..a3c4d237 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/InstanceofOperator.js @@ -0,0 +1,30 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var $hasInstance = GetIntrinsic('Symbol.hasInstance', true); + +var Call = require('./Call'); +var GetMethod = require('./GetMethod'); +var IsCallable = require('./IsCallable'); +var OrdinaryHasInstance = require('./OrdinaryHasInstance'); +var ToBoolean = require('./ToBoolean'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator + +module.exports = function InstanceofOperator(O, C) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + var instOfHandler = $hasInstance ? GetMethod(C, $hasInstance) : void 0; + if (typeof instOfHandler !== 'undefined') { + return ToBoolean(Call(instOfHandler, C, [O])); + } + if (!IsCallable(C)) { + throw new $TypeError('`C` is not Callable'); + } + return OrdinaryHasInstance(C, O); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Invoke.js b/docs/snippets/node_modules/es-abstract/2021/Invoke.js new file mode 100644 index 00000000..d4214ee5 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Invoke.js @@ -0,0 +1,24 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var IsArray = require('./IsArray'); +var GetV = require('./GetV'); +var IsPropertyKey = require('./IsPropertyKey'); + +// https://ecma-international.org/ecma-262/6.0/#sec-invoke + +module.exports = function Invoke(O, P) { + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: P must be a Property Key'); + } + var argumentsList = arguments.length > 2 ? arguments[2] : []; + if (!IsArray(argumentsList)) { + throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List'); + } + var func = GetV(O, P); + return Call(func, O, argumentsList); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsAccessorDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/IsAccessorDescriptor.js new file mode 100644 index 00000000..78563e7e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsAccessorDescriptor.js @@ -0,0 +1,23 @@ +'use strict'; + +var has = require('has'); + +var assertRecord = require('../helpers/assertRecord'); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor + +module.exports = function IsAccessorDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return false; + } + + assertRecord(Type, 'Property Descriptor', 'Desc', Desc); + + if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) { + return false; + } + + return true; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsArray.js b/docs/snippets/node_modules/es-abstract/2021/IsArray.js new file mode 100644 index 00000000..f933cec0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsArray.js @@ -0,0 +1,14 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Array = GetIntrinsic('%Array%'); + +// eslint-disable-next-line global-require +var toStr = !$Array.isArray && require('call-bind/callBound')('Object.prototype.toString'); + +// https://ecma-international.org/ecma-262/6.0/#sec-isarray + +module.exports = $Array.isArray || function IsArray(argument) { + return toStr(argument) === '[object Array]'; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsBigIntElementType.js b/docs/snippets/node_modules/es-abstract/2021/IsBigIntElementType.js new file mode 100644 index 00000000..e3f58a94 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsBigIntElementType.js @@ -0,0 +1,7 @@ +'use strict'; + +// https://262.ecma-international.org/11.0/#sec-isbigintelementtype + +module.exports = function IsBigIntElementType(type) { + return type === 'BigUint64' || type === 'BigInt64'; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsCallable.js b/docs/snippets/node_modules/es-abstract/2021/IsCallable.js new file mode 100644 index 00000000..3a69b192 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsCallable.js @@ -0,0 +1,5 @@ +'use strict'; + +// http://262.ecma-international.org/5.1/#sec-9.11 + +module.exports = require('is-callable'); diff --git a/docs/snippets/node_modules/es-abstract/2021/IsCompatiblePropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/IsCompatiblePropertyDescriptor.js new file mode 100644 index 00000000..8bdaf3eb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsCompatiblePropertyDescriptor.js @@ -0,0 +1,9 @@ +'use strict'; + +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://262.ecma-international.org/6.0/#sec-iscompatiblepropertydescriptor + +module.exports = function IsCompatiblePropertyDescriptor(Extensible, Desc, Current) { + return ValidateAndApplyPropertyDescriptor(undefined, undefined, Extensible, Desc, Current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsConcatSpreadable.js b/docs/snippets/node_modules/es-abstract/2021/IsConcatSpreadable.js new file mode 100644 index 00000000..141b3341 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsConcatSpreadable.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $isConcatSpreadable = GetIntrinsic('%Symbol.isConcatSpreadable%', true); + +var Get = require('./Get'); +var IsArray = require('./IsArray'); +var ToBoolean = require('./ToBoolean'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable + +module.exports = function IsConcatSpreadable(O) { + if (Type(O) !== 'Object') { + return false; + } + if ($isConcatSpreadable) { + var spreadable = Get(O, $isConcatSpreadable); + if (typeof spreadable !== 'undefined') { + return ToBoolean(spreadable); + } + } + return IsArray(O); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsConstructor.js b/docs/snippets/node_modules/es-abstract/2021/IsConstructor.js new file mode 100644 index 00000000..fe626e18 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsConstructor.js @@ -0,0 +1,40 @@ +'use strict'; + +var GetIntrinsic = require('../GetIntrinsic.js'); + +var $construct = GetIntrinsic('%Reflect.construct%', true); + +var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); +try { + DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} }); +} catch (e) { + // Accessor properties aren't supported + DefinePropertyOrThrow = null; +} + +// https://ecma-international.org/ecma-262/6.0/#sec-isconstructor + +if (DefinePropertyOrThrow && $construct) { + var isConstructorMarker = {}; + var badArrayLike = {}; + DefinePropertyOrThrow(badArrayLike, 'length', { + '[[Get]]': function () { + throw isConstructorMarker; + }, + '[[Enumerable]]': true + }); + + module.exports = function IsConstructor(argument) { + try { + // `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`: + $construct(argument, badArrayLike); + } catch (err) { + return err === isConstructorMarker; + } + }; +} else { + module.exports = function IsConstructor(argument) { + // unfortunately there's no way to truly check this without try/catch `new argument` in old environments + return typeof argument === 'function' && !!argument.prototype; + }; +} diff --git a/docs/snippets/node_modules/es-abstract/2021/IsDataDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/IsDataDescriptor.js new file mode 100644 index 00000000..00d14a60 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsDataDescriptor.js @@ -0,0 +1,23 @@ +'use strict'; + +var has = require('has'); + +var assertRecord = require('../helpers/assertRecord'); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor + +module.exports = function IsDataDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return false; + } + + assertRecord(Type, 'Property Descriptor', 'Desc', Desc); + + if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) { + return false; + } + + return true; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsExtensible.js b/docs/snippets/node_modules/es-abstract/2021/IsExtensible.js new file mode 100644 index 00000000..9df5b80b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsExtensible.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Object = GetIntrinsic('%Object%'); + +var isPrimitive = require('../helpers/isPrimitive'); + +var $preventExtensions = $Object.preventExtensions; +var $isExtensible = $Object.isExtensible; + +// https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o + +module.exports = $preventExtensions + ? function IsExtensible(obj) { + return !isPrimitive(obj) && $isExtensible(obj); + } + : function IsExtensible(obj) { + return !isPrimitive(obj); + }; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsGenericDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/IsGenericDescriptor.js new file mode 100644 index 00000000..95b1d353 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsGenericDescriptor.js @@ -0,0 +1,23 @@ +'use strict'; + +var assertRecord = require('../helpers/assertRecord'); + +var IsAccessorDescriptor = require('./IsAccessorDescriptor'); +var IsDataDescriptor = require('./IsDataDescriptor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor + +module.exports = function IsGenericDescriptor(Desc) { + if (typeof Desc === 'undefined') { + return false; + } + + assertRecord(Type, 'Property Descriptor', 'Desc', Desc); + + if (!IsAccessorDescriptor(Desc) && !IsDataDescriptor(Desc)) { + return true; + } + + return false; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsIntegralNumber.js b/docs/snippets/node_modules/es-abstract/2021/IsIntegralNumber.js new file mode 100644 index 00000000..0a02bfe0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsIntegralNumber.js @@ -0,0 +1,18 @@ +'use strict'; + +var abs = require('./abs'); +var floor = require('./floor'); +var Type = require('./Type'); + +var $isNaN = require('../helpers/isNaN'); +var $isFinite = require('../helpers/isFinite'); + +// https://tc39.es/ecma262/#sec-isintegralnumber + +module.exports = function IsIntegralNumber(argument) { + if (Type(argument) !== 'Number' || $isNaN(argument) || !$isFinite(argument)) { + return false; + } + var absValue = abs(argument); + return floor(absValue) === absValue; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsNoTearConfiguration.js b/docs/snippets/node_modules/es-abstract/2021/IsNoTearConfiguration.js new file mode 100644 index 00000000..f0d28087 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsNoTearConfiguration.js @@ -0,0 +1,16 @@ +'use strict'; + +var IsUnclampedIntegerElementType = require('./IsUnclampedIntegerElementType'); +var IsBigIntElementType = require('./IsBigIntElementType'); + +// https://262.ecma-international.org/11.0/#sec-isnotearconfiguration + +module.exports = function IsNoTearConfiguration(type, order) { + if (IsUnclampedIntegerElementType(type)) { + return true; + } + if (IsBigIntElementType(type) && order !== 'Init' && order !== 'Unordered') { + return true; + } + return false; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsPromise.js b/docs/snippets/node_modules/es-abstract/2021/IsPromise.js new file mode 100644 index 00000000..a551ae0c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsPromise.js @@ -0,0 +1,24 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); + +var $PromiseThen = callBound('Promise.prototype.then', true); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-ispromise + +module.exports = function IsPromise(x) { + if (Type(x) !== 'Object') { + return false; + } + if (!$PromiseThen) { // Promises are not supported + return false; + } + try { + $PromiseThen(x); // throws if not a promise + } catch (e) { + return false; + } + return true; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsPropertyKey.js b/docs/snippets/node_modules/es-abstract/2021/IsPropertyKey.js new file mode 100644 index 00000000..f43ab581 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsPropertyKey.js @@ -0,0 +1,7 @@ +'use strict'; + +// https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey + +module.exports = function IsPropertyKey(argument) { + return typeof argument === 'string' || typeof argument === 'symbol'; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsRegExp.js b/docs/snippets/node_modules/es-abstract/2021/IsRegExp.js new file mode 100644 index 00000000..e1054813 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsRegExp.js @@ -0,0 +1,24 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $match = GetIntrinsic('%Symbol.match%', true); + +var hasRegExpMatcher = require('is-regex'); + +var ToBoolean = require('./ToBoolean'); + +// https://ecma-international.org/ecma-262/6.0/#sec-isregexp + +module.exports = function IsRegExp(argument) { + if (!argument || typeof argument !== 'object') { + return false; + } + if ($match) { + var isRegExp = argument[$match]; + if (typeof isRegExp !== 'undefined') { + return ToBoolean(isRegExp); + } + } + return hasRegExpMatcher(argument); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsSharedArrayBuffer.js b/docs/snippets/node_modules/es-abstract/2021/IsSharedArrayBuffer.js new file mode 100644 index 00000000..8e96e33f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsSharedArrayBuffer.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('./Type'); + +var isSharedArrayBuffer = require('is-shared-array-buffer'); + +// https://262.ecma-international.org/8.0/#sec-issharedarraybuffer + +module.exports = function IsSharedArrayBuffer(obj) { + if (Type(obj) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + + return isSharedArrayBuffer(obj); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsStringPrefix.js b/docs/snippets/node_modules/es-abstract/2021/IsStringPrefix.js new file mode 100644 index 00000000..4958544c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsStringPrefix.js @@ -0,0 +1,47 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isPrefixOf = require('../helpers/isPrefixOf'); + +// var callBound = require('call-bind/callBound'); + +// var $charAt = callBound('String.prototype.charAt'); + +var Type = require('./Type'); + +// https://262.ecma-international.org/9.0/#sec-isstringprefix + +module.exports = function IsStringPrefix(p, q) { + if (Type(p) !== 'String') { + throw new $TypeError('Assertion failed: "p" must be a String'); + } + + if (Type(q) !== 'String') { + throw new $TypeError('Assertion failed: "q" must be a String'); + } + + return isPrefixOf(p, q); + /* + if (p === q || p === '') { + return true; + } + + var pLength = p.length; + var qLength = q.length; + if (pLength >= qLength) { + return false; + } + + // assert: pLength < qLength + + for (var i = 0; i < pLength; i += 1) { + if ($charAt(p, i) !== $charAt(q, i)) { + return false; + } + } + return true; + */ +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsUnclampedIntegerElementType.js b/docs/snippets/node_modules/es-abstract/2021/IsUnclampedIntegerElementType.js new file mode 100644 index 00000000..15237b1f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsUnclampedIntegerElementType.js @@ -0,0 +1,12 @@ +'use strict'; + +// https://262.ecma-international.org/11.0/#sec-isunclampedintegerelementtype + +module.exports = function IsUnclampedIntegerElementType(type) { + return type === 'Int8' + || type === 'Uint8' + || type === 'Int16' + || type === 'Uint16' + || type === 'Int32' + || type === 'Uint32'; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IsUnsignedElementType.js b/docs/snippets/node_modules/es-abstract/2021/IsUnsignedElementType.js new file mode 100644 index 00000000..5eb1e7c4 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IsUnsignedElementType.js @@ -0,0 +1,11 @@ +'use strict'; + +// https://262.ecma-international.org/11.0/#sec-isunsignedelementtype + +module.exports = function IsUnsignedElementType(type) { + return type === 'Uint8' + || type === 'Uint8C' + || type === 'Uint16' + || type === 'Uint32' + || type === 'BigUint64'; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IterableToList.js b/docs/snippets/node_modules/es-abstract/2021/IterableToList.js new file mode 100644 index 00000000..320ab471 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IterableToList.js @@ -0,0 +1,29 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); +var $arrayPush = callBound('Array.prototype.push'); + +var GetIterator = require('./GetIterator'); +var IteratorStep = require('./IteratorStep'); +var IteratorValue = require('./IteratorValue'); + +// https://262.ecma-international.org/12.0/#sec-iterabletolist + +module.exports = function IterableToList(items) { + var iterator; + if (arguments.length > 1) { + iterator = GetIterator(items, 'sync', arguments[1]); + } else { + iterator = GetIterator(items, 'sync'); + } + var values = []; + var next = true; + while (next) { + next = IteratorStep(iterator); + if (next) { + var nextValue = IteratorValue(next); + $arrayPush(values, nextValue); + } + } + return values; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IteratorClose.js b/docs/snippets/node_modules/es-abstract/2021/IteratorClose.js new file mode 100644 index 00000000..dd1118df --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IteratorClose.js @@ -0,0 +1,50 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var GetMethod = require('./GetMethod'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose + +module.exports = function IteratorClose(iterator, completion) { + if (Type(iterator) !== 'Object') { + throw new $TypeError('Assertion failed: Type(iterator) is not Object'); + } + if (!IsCallable(completion)) { + throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record'); + } + var completionThunk = completion; + + var iteratorReturn = GetMethod(iterator, 'return'); + + if (typeof iteratorReturn === 'undefined') { + return completionThunk(); + } + + var completionRecord; + try { + var innerResult = Call(iteratorReturn, iterator, []); + } catch (e) { + // if we hit here, then "e" is the innerResult completion that needs re-throwing + + // if the completion is of type "throw", this will throw. + completionThunk(); + completionThunk = null; // ensure it's not called twice. + + // if not, then return the innerResult completion + throw e; + } + completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does + completionThunk = null; // ensure it's not called twice. + + if (Type(innerResult) !== 'Object') { + throw new $TypeError('iterator .return must return an object'); + } + + return completionRecord; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IteratorComplete.js b/docs/snippets/node_modules/es-abstract/2021/IteratorComplete.js new file mode 100644 index 00000000..ed4efa37 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IteratorComplete.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Get = require('./Get'); +var ToBoolean = require('./ToBoolean'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete + +module.exports = function IteratorComplete(iterResult) { + if (Type(iterResult) !== 'Object') { + throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); + } + return ToBoolean(Get(iterResult, 'done')); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IteratorNext.js b/docs/snippets/node_modules/es-abstract/2021/IteratorNext.js new file mode 100644 index 00000000..cf80655b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IteratorNext.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Invoke = require('./Invoke'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-iteratornext + +module.exports = function IteratorNext(iterator, value) { + var result = Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]); + if (Type(result) !== 'Object') { + throw new $TypeError('iterator next must return an object'); + } + return result; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/IteratorStep.js b/docs/snippets/node_modules/es-abstract/2021/IteratorStep.js new file mode 100644 index 00000000..41b9d1b2 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IteratorStep.js @@ -0,0 +1,13 @@ +'use strict'; + +var IteratorComplete = require('./IteratorComplete'); +var IteratorNext = require('./IteratorNext'); + +// https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep + +module.exports = function IteratorStep(iterator) { + var result = IteratorNext(iterator); + var done = IteratorComplete(result); + return done === true ? false : result; +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/IteratorValue.js b/docs/snippets/node_modules/es-abstract/2021/IteratorValue.js new file mode 100644 index 00000000..d15d8aeb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/IteratorValue.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Get = require('./Get'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue + +module.exports = function IteratorValue(iterResult) { + if (Type(iterResult) !== 'Object') { + throw new $TypeError('Assertion failed: Type(iterResult) is not Object'); + } + return Get(iterResult, 'value'); +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/LengthOfArrayLike.js b/docs/snippets/node_modules/es-abstract/2021/LengthOfArrayLike.js new file mode 100644 index 00000000..132c4d58 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/LengthOfArrayLike.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Get = require('./Get'); +var ToLength = require('./ToLength'); +var Type = require('./Type'); + +// https://262.ecma-international.org/11.0/#sec-lengthofarraylike + +module.exports = function LengthOfArrayLike(obj) { + if (Type(obj) !== 'Object') { + throw new $TypeError('Assertion failed: `obj` must be an Object'); + } + return ToLength(Get(obj, 'length')); +}; + +// TODO: use this all over diff --git a/docs/snippets/node_modules/es-abstract/2021/MakeDate.js b/docs/snippets/node_modules/es-abstract/2021/MakeDate.js new file mode 100644 index 00000000..efeb6452 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/MakeDate.js @@ -0,0 +1,13 @@ +'use strict'; + +var $isFinite = require('../helpers/isFinite'); +var msPerDay = require('../helpers/timeConstants').msPerDay; + +// https://262.ecma-international.org/5.1/#sec-15.9.1.13 + +module.exports = function MakeDate(day, time) { + if (!$isFinite(day) || !$isFinite(time)) { + return NaN; + } + return (day * msPerDay) + time; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/MakeDay.js b/docs/snippets/node_modules/es-abstract/2021/MakeDay.js new file mode 100644 index 00000000..db78bbc7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/MakeDay.js @@ -0,0 +1,36 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $DateUTC = GetIntrinsic('%Date.UTC%'); + +var $isFinite = require('../helpers/isFinite'); + +var DateFromTime = require('./DateFromTime'); +var Day = require('./Day'); +var floor = require('./floor'); +var modulo = require('./modulo'); +var MonthFromTime = require('./MonthFromTime'); +var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); +var YearFromTime = require('./YearFromTime'); + +// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.12 + +module.exports = function MakeDay(year, month, date) { + if (!$isFinite(year) || !$isFinite(month) || !$isFinite(date)) { + return NaN; + } + var y = ToIntegerOrInfinity(year); + var m = ToIntegerOrInfinity(month); + var dt = ToIntegerOrInfinity(date); + var ym = y + floor(m / 12); + if (!$isFinite(ym)) { + return NaN; + } + var mn = modulo(m, 12); + var t = $DateUTC(ym, mn, 1); + if (YearFromTime(t) !== ym || MonthFromTime(t) !== mn || DateFromTime(t) !== 1) { + return NaN; + } + return Day(t) + dt - 1; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/MakeTime.js b/docs/snippets/node_modules/es-abstract/2021/MakeTime.js new file mode 100644 index 00000000..330d3bdb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/MakeTime.js @@ -0,0 +1,23 @@ +'use strict'; + +var $isFinite = require('../helpers/isFinite'); +var timeConstants = require('../helpers/timeConstants'); +var msPerSecond = timeConstants.msPerSecond; +var msPerMinute = timeConstants.msPerMinute; +var msPerHour = timeConstants.msPerHour; + +var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); + +// https://ecma-international.org/ecma-262/5.1/#sec-15.9.1.11 + +module.exports = function MakeTime(hour, min, sec, ms) { + if (!$isFinite(hour) || !$isFinite(min) || !$isFinite(sec) || !$isFinite(ms)) { + return NaN; + } + var h = ToIntegerOrInfinity(hour); + var m = ToIntegerOrInfinity(min); + var s = ToIntegerOrInfinity(sec); + var milli = ToIntegerOrInfinity(ms); + var t = (h * msPerHour) + (m * msPerMinute) + (s * msPerSecond) + milli; + return t; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/MinFromTime.js b/docs/snippets/node_modules/es-abstract/2021/MinFromTime.js new file mode 100644 index 00000000..a0c631d4 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/MinFromTime.js @@ -0,0 +1,14 @@ +'use strict'; + +var floor = require('./floor'); +var modulo = require('./modulo'); + +var timeConstants = require('../helpers/timeConstants'); +var msPerMinute = timeConstants.msPerMinute; +var MinutesPerHour = timeConstants.MinutesPerHour; + +// https://262.ecma-international.org/5.1/#sec-15.9.1.10 + +module.exports = function MinFromTime(t) { + return modulo(floor(t / msPerMinute), MinutesPerHour); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/MonthFromTime.js b/docs/snippets/node_modules/es-abstract/2021/MonthFromTime.js new file mode 100644 index 00000000..a482a7df --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/MonthFromTime.js @@ -0,0 +1,47 @@ +'use strict'; + +var DayWithinYear = require('./DayWithinYear'); +var InLeapYear = require('./InLeapYear'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.4 + +module.exports = function MonthFromTime(t) { + var day = DayWithinYear(t); + if (0 <= day && day < 31) { + return 0; + } + var leap = InLeapYear(t); + if (31 <= day && day < (59 + leap)) { + return 1; + } + if ((59 + leap) <= day && day < (90 + leap)) { + return 2; + } + if ((90 + leap) <= day && day < (120 + leap)) { + return 3; + } + if ((120 + leap) <= day && day < (151 + leap)) { + return 4; + } + if ((151 + leap) <= day && day < (181 + leap)) { + return 5; + } + if ((181 + leap) <= day && day < (212 + leap)) { + return 6; + } + if ((212 + leap) <= day && day < (243 + leap)) { + return 7; + } + if ((243 + leap) <= day && day < (273 + leap)) { + return 8; + } + if ((273 + leap) <= day && day < (304 + leap)) { + return 9; + } + if ((304 + leap) <= day && day < (334 + leap)) { + return 10; + } + if ((334 + leap) <= day && day < (365 + leap)) { + return 11; + } +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/add.js b/docs/snippets/node_modules/es-abstract/2021/Number/add.js new file mode 100644 index 00000000..8d6271f5 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/add.js @@ -0,0 +1,36 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isFinite = require('../../helpers/isFinite'); +var isNaN = require('../../helpers/isNaN'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/12.0/#sec-numeric-types-number-add + +module.exports = function NumberAdd(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + + if (isNaN(x) || isNaN(y) || (x === Infinity && y === -Infinity) || (x === -Infinity && y === Infinity)) { + return NaN; + } + + if (!isFinite(x)) { + return x; + } + if (!isFinite(y)) { + return y; + } + + if (x === y && x === 0) { // both zeroes + return Infinity / x === -Infinity && Infinity / y === -Infinity ? -0 : +0; + } + + // shortcut for the actual spec mechanics + return x + y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseAND.js b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseAND.js new file mode 100644 index 00000000..a7159802 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseAND.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var NumberBitwiseOp = require('../NumberBitwiseOp'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseAND + +module.exports = function NumberBitwiseAND(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + return NumberBitwiseOp('&', x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseNOT.js b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseNOT.js new file mode 100644 index 00000000..ae8032a7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseNOT.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var ToInt32 = require('../ToInt32'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseNOT + +module.exports = function NumberBitwiseNOT(x) { + if (Type(x) !== 'Number') { + throw new $TypeError('Assertion failed: `x` argument must be a Number'); + } + var oldValue = ToInt32(x); + // Return the result of applying the bitwise operator op to lnum and rnum. The result is a signed 32-bit integer. + return ~oldValue; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseOR.js b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseOR.js new file mode 100644 index 00000000..c5e67b96 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseOR.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var NumberBitwiseOp = require('../NumberBitwiseOp'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseOR + +module.exports = function NumberBitwiseOR(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + return NumberBitwiseOp('|', x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseXOR.js b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseXOR.js new file mode 100644 index 00000000..a4030e9a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/bitwiseXOR.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var NumberBitwiseOp = require('../NumberBitwiseOp'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-bitwiseXOR + +module.exports = function NumberBitwiseXOR(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + return NumberBitwiseOp('^', x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/divide.js b/docs/snippets/node_modules/es-abstract/2021/Number/divide.js new file mode 100644 index 00000000..65244625 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/divide.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isFinite = require('../../helpers/isFinite'); +var isNaN = require('../../helpers/isNaN'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-divide + +module.exports = function NumberDivide(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + if (isNaN(x) || isNaN(y) || (!isFinite(x) && !isFinite(y))) { + return NaN; + } + // shortcut for the actual spec mechanics + return x / y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/equal.js b/docs/snippets/node_modules/es-abstract/2021/Number/equal.js new file mode 100644 index 00000000..db68afa4 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/equal.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isNaN = require('../../helpers/isNaN'); +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-equal + +module.exports = function NumberEqual(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + if (isNaN(x) || isNaN(y)) { + return false; + } + // shortcut for the actual spec mechanics + return x === y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/exponentiate.js b/docs/snippets/node_modules/es-abstract/2021/Number/exponentiate.js new file mode 100644 index 00000000..bafa7b11 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/exponentiate.js @@ -0,0 +1,77 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +// var isNegativeZero = require('is-negative-zero'); + +var $pow = GetIntrinsic('%Math.pow%'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +/* +var abs = require('../../helpers/abs'); +var isFinite = require('../../helpers/isFinite'); +var isNaN = require('../../helpers/isNaN'); + +var IsInteger = require('../IsInteger'); +*/ +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-exponentiate + +/* eslint max-lines-per-function: 0, max-statements: 0 */ + +module.exports = function NumberExponentiate(base, exponent) { + if (Type(base) !== 'Number' || Type(exponent) !== 'Number') { + throw new $TypeError('Assertion failed: `base` and `exponent` arguments must be Numbers'); + } + return $pow(base, exponent); + /* + if (isNaN(exponent)) { + return NaN; + } + if (exponent === 0) { + return 1; + } + if (isNaN(base)) { + return NaN; + } + var aB = abs(base); + if (aB > 1 && exponent === Infinity) { + return Infinity; + } + if (aB > 1 && exponent === -Infinity) { + return 0; + } + if (aB === 1 && (exponent === Infinity || exponent === -Infinity)) { + return NaN; + } + if (aB < 1 && exponent === Infinity) { + return +0; + } + if (aB < 1 && exponent === -Infinity) { + return Infinity; + } + if (base === Infinity) { + return exponent > 0 ? Infinity : 0; + } + if (base === -Infinity) { + var isOdd = true; + if (exponent > 0) { + return isOdd ? -Infinity : Infinity; + } + return isOdd ? -0 : 0; + } + if (exponent > 0) { + return isNegativeZero(base) ? Infinity : 0; + } + if (isNegativeZero(base)) { + if (exponent > 0) { + return isOdd ? -0 : 0; + } + return isOdd ? -Infinity : Infinity; + } + if (base < 0 && isFinite(base) && isFinite(exponent) && !IsInteger(exponent)) { + return NaN; + } + */ +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/index.js b/docs/snippets/node_modules/es-abstract/2021/Number/index.js new file mode 100644 index 00000000..63ec52da --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/index.js @@ -0,0 +1,43 @@ +'use strict'; + +var add = require('./add'); +var bitwiseAND = require('./bitwiseAND'); +var bitwiseNOT = require('./bitwiseNOT'); +var bitwiseOR = require('./bitwiseOR'); +var bitwiseXOR = require('./bitwiseXOR'); +var divide = require('./divide'); +var equal = require('./equal'); +var exponentiate = require('./exponentiate'); +var leftShift = require('./leftShift'); +var lessThan = require('./lessThan'); +var multiply = require('./multiply'); +var remainder = require('./remainder'); +var sameValue = require('./sameValue'); +var sameValueZero = require('./sameValueZero'); +var signedRightShift = require('./signedRightShift'); +var subtract = require('./subtract'); +var toString = require('./toString'); +var unaryMinus = require('./unaryMinus'); +var unsignedRightShift = require('./unsignedRightShift'); + +module.exports = { + add: add, + bitwiseAND: bitwiseAND, + bitwiseNOT: bitwiseNOT, + bitwiseOR: bitwiseOR, + bitwiseXOR: bitwiseXOR, + divide: divide, + equal: equal, + exponentiate: exponentiate, + leftShift: leftShift, + lessThan: lessThan, + multiply: multiply, + remainder: remainder, + sameValue: sameValue, + sameValueZero: sameValueZero, + signedRightShift: signedRightShift, + subtract: subtract, + toString: toString, + unaryMinus: unaryMinus, + unsignedRightShift: unsignedRightShift +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/leftShift.js b/docs/snippets/node_modules/es-abstract/2021/Number/leftShift.js new file mode 100644 index 00000000..023b3390 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/leftShift.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var ToInt32 = require('../ToInt32'); +var ToUint32 = require('../ToUint32'); +var modulo = require('../modulo'); +var Type = require('../Type'); + +// https://262.ecma-international.org/12.0/#sec-numeric-types-number-leftShift + +module.exports = function NumberLeftShift(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + + var lnum = ToInt32(x); + var rnum = ToUint32(y); + + var shiftCount = modulo(rnum, 32); + + return lnum << shiftCount; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/lessThan.js b/docs/snippets/node_modules/es-abstract/2021/Number/lessThan.js new file mode 100644 index 00000000..5fcac24e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/lessThan.js @@ -0,0 +1,26 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isNaN = require('../../helpers/isNaN'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-lessThan + +module.exports = function NumberLessThan(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + + // If x is NaN, return undefined. + // If y is NaN, return undefined. + if (isNaN(x) || isNaN(y)) { + return void undefined; + } + + // shortcut for the actual spec mechanics + return x < y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/multiply.js b/docs/snippets/node_modules/es-abstract/2021/Number/multiply.js new file mode 100644 index 00000000..2a6c478a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/multiply.js @@ -0,0 +1,33 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isNaN = require('../../helpers/isNaN'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-multiply + +module.exports = function NumberMultiply(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + + if (isNaN(x) || isNaN(y) || (x === 0 && !isFinite(y)) || (!isFinite(x) && y === 0)) { + return NaN; + } + if (!isFinite(x) && !isFinite(y)) { + return x === y ? Infinity : -Infinity; + } + if (!isFinite(x) && y !== 0) { + return x > 0 ? Infinity : -Infinity; + } + if (!isFinite(y) && x !== 0) { + return y > 0 ? Infinity : -Infinity; + } + + // shortcut for the actual spec mechanics + return x * y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/remainder.js b/docs/snippets/node_modules/es-abstract/2021/Number/remainder.js new file mode 100644 index 00000000..c9a7c2d7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/remainder.js @@ -0,0 +1,32 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isNaN = require('../../helpers/isNaN'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/12.0/#sec-numeric-types-number-remainder + +module.exports = function NumberRemainder(n, d) { + if (Type(n) !== 'Number' || Type(d) !== 'Number') { + throw new $TypeError('Assertion failed: `n` and `d` arguments must be Numbers'); + } + + // If either operand is NaN, the result is NaN. + // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. + if (isNaN(n) || isNaN(d) || !isFinite(n) || d === 0) { + return NaN; + } + + // If the dividend is finite and the divisor is an infinity, the result equals the dividend. + // If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend. + if (!isFinite(d) || n === 0) { + return n; + } + + // In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved… + return n % d; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/sameValue.js b/docs/snippets/node_modules/es-abstract/2021/Number/sameValue.js new file mode 100644 index 00000000..19efc379 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/sameValue.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var isNegativeZero = require('is-negative-zero'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); +var NumberSameValueZero = require('./sameValueZero'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValue + +module.exports = function NumberSameValue(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + if (x === 0 && y === 0) { + return !(isNegativeZero(x) ^ isNegativeZero(y)); + } + return NumberSameValueZero(x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/sameValueZero.js b/docs/snippets/node_modules/es-abstract/2021/Number/sameValueZero.js new file mode 100644 index 00000000..5688198f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/sameValueZero.js @@ -0,0 +1,24 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isNaN = require('../../helpers/isNaN'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-sameValueZero + +module.exports = function NumberSameValueZero(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + + var xNaN = isNaN(x); + var yNaN = isNaN(y); + if (xNaN || yNaN) { + return xNaN === yNaN; + } + return x === y; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/signedRightShift.js b/docs/snippets/node_modules/es-abstract/2021/Number/signedRightShift.js new file mode 100644 index 00000000..025f39a1 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/signedRightShift.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var ToInt32 = require('../ToInt32'); +var ToUint32 = require('../ToUint32'); +var modulo = require('../modulo'); +var Type = require('../Type'); + +// https://262.ecma-international.org/12.0/#sec-numeric-types-number-signedRightShift + +module.exports = function NumberSignedRightShift(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + + var lnum = ToInt32(x); + var rnum = ToUint32(y); + + var shiftCount = modulo(rnum, 32); + + return lnum >> shiftCount; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/subtract.js b/docs/snippets/node_modules/es-abstract/2021/Number/subtract.js new file mode 100644 index 00000000..29a29e61 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/subtract.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +var NumberAdd = require('./add'); +var NumberUnaryMinus = require('./unaryMinus'); + +// https://262.ecma-international.org/12.0/#sec-numeric-types-number-subtract + +module.exports = function NumberSubtract(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + return NumberAdd(x, NumberUnaryMinus(y)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/toString.js b/docs/snippets/node_modules/es-abstract/2021/Number/toString.js new file mode 100644 index 00000000..4f133160 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/toString.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $String = GetIntrinsic('%String%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-tostring + +module.exports = function NumberToString(x) { + if (Type(x) !== 'Number') { + throw new $TypeError('Assertion failed: `x` must be a Number'); + } + + return $String(x); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/unaryMinus.js b/docs/snippets/node_modules/es-abstract/2021/Number/unaryMinus.js new file mode 100644 index 00000000..794582ad --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/unaryMinus.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var isNaN = require('../../helpers/isNaN'); + +var Type = require('../Type'); + +// https://262.ecma-international.org/11.0/#sec-numeric-types-number-unaryMinus + +module.exports = function NumberUnaryMinus(x) { + if (Type(x) !== 'Number') { + throw new $TypeError('Assertion failed: `x` argument must be a Number'); + } + if (isNaN(x)) { + return NaN; + } + return -x; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Number/unsignedRightShift.js b/docs/snippets/node_modules/es-abstract/2021/Number/unsignedRightShift.js new file mode 100644 index 00000000..2eb967ac --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Number/unsignedRightShift.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var ToInt32 = require('../ToInt32'); +var ToUint32 = require('../ToUint32'); +var modulo = require('../modulo'); +var Type = require('../Type'); + +// https://262.ecma-international.org/12.0/#sec-numeric-types-number-unsignedRightShift + +module.exports = function NumberUnsignedRightShift(x, y) { + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + + var lnum = ToInt32(x); + var rnum = ToUint32(y); + + var shiftCount = modulo(rnum, 32); + + return lnum >>> shiftCount; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/NumberBitwiseOp.js b/docs/snippets/node_modules/es-abstract/2021/NumberBitwiseOp.js new file mode 100644 index 00000000..11425ffd --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/NumberBitwiseOp.js @@ -0,0 +1,29 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var ToInt32 = require('./ToInt32'); +var ToUint32 = require('./ToUint32'); +var Type = require('./Type'); + +// https://262.ecma-international.org/11.0/#sec-numberbitwiseop + +module.exports = function NumberBitwiseOp(op, x, y) { + if (op !== '&' && op !== '|' && op !== '^') { + throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`'); + } + if (Type(x) !== 'Number' || Type(y) !== 'Number') { + throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers'); + } + var lnum = ToInt32(x); + var rnum = ToUint32(y); + if (op === '&') { + return lnum & rnum; + } + if (op === '|') { + return lnum | rnum; + } + return lnum ^ rnum; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/NumberToBigInt.js b/docs/snippets/node_modules/es-abstract/2021/NumberToBigInt.js new file mode 100644 index 00000000..018afddf --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/NumberToBigInt.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $RangeError = GetIntrinsic('%RangeError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsIntegralNumber = require('./IsIntegralNumber'); +var Type = require('./Type'); + +// https://262.ecma-international.org/11.0/#sec-numbertobigint + +module.exports = function NumberToBigInt(number) { + if (Type(number) !== 'Number') { + throw new $TypeError('Assertion failed: `number` must be a String'); + } + if (!IsIntegralNumber(number)) { + throw new $RangeError('The number ' + number + ' cannot be converted to a BigInt because it is not an integer'); + } + return $BigInt(number); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryCreateFromConstructor.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryCreateFromConstructor.js new file mode 100644 index 00000000..8f3bb829 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryCreateFromConstructor.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var GetPrototypeFromConstructor = require('./GetPrototypeFromConstructor'); +var IsArray = require('./IsArray'); +var OrdinaryObjectCreate = require('./OrdinaryObjectCreate'); + +// https://262.ecma-international.org/6.0/#sec-ordinarycreatefromconstructor + +module.exports = function OrdinaryCreateFromConstructor(constructor, intrinsicDefaultProto) { + GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic + var proto = GetPrototypeFromConstructor(constructor, intrinsicDefaultProto); + var slots = arguments.length < 3 ? [] : arguments[2]; + if (!IsArray(slots)) { + throw new $TypeError('Assertion failed: if provided, `internalSlotsList` must be a List'); + } + return OrdinaryObjectCreate(proto, slots); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryDefineOwnProperty.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryDefineOwnProperty.js new file mode 100644 index 00000000..5d33aa6d --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryDefineOwnProperty.js @@ -0,0 +1,61 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = require('../helpers/getOwnPropertyDescriptor'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); + +var IsAccessorDescriptor = require('./IsAccessorDescriptor'); +var IsDataDescriptor = require('./IsDataDescriptor'); +var IsExtensible = require('./IsExtensible'); +var IsPropertyKey = require('./IsPropertyKey'); +var ToPropertyDescriptor = require('./ToPropertyDescriptor'); +var SameValue = require('./SameValue'); +var Type = require('./Type'); +var ValidateAndApplyPropertyDescriptor = require('./ValidateAndApplyPropertyDescriptor'); + +// https://ecma-international.org/ecma-262/6.0/#sec-ordinarydefineownproperty + +module.exports = function OrdinaryDefineOwnProperty(O, P, Desc) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: O must be an Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: P must be a Property Key'); + } + if (!isPropertyDescriptor({ + Type: Type, + IsDataDescriptor: IsDataDescriptor, + IsAccessorDescriptor: IsAccessorDescriptor + }, Desc)) { + throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); + } + if (!$gOPD) { + // ES3/IE 8 fallback + if (IsAccessorDescriptor(Desc)) { + throw new $SyntaxError('This environment does not support accessor property descriptors.'); + } + var creatingNormalDataProperty = !(P in O) + && Desc['[[Writable]]'] + && Desc['[[Enumerable]]'] + && Desc['[[Configurable]]'] + && '[[Value]]' in Desc; + var settingExistingDataProperty = (P in O) + && (!('[[Configurable]]' in Desc) || Desc['[[Configurable]]']) + && (!('[[Enumerable]]' in Desc) || Desc['[[Enumerable]]']) + && (!('[[Writable]]' in Desc) || Desc['[[Writable]]']) + && '[[Value]]' in Desc; + if (creatingNormalDataProperty || settingExistingDataProperty) { + O[P] = Desc['[[Value]]']; // eslint-disable-line no-param-reassign + return SameValue(O[P], Desc['[[Value]]']); + } + throw new $SyntaxError('This environment does not support defining non-writable, non-enumerable, or non-configurable properties'); + } + var desc = $gOPD(O, P); + var current = desc && ToPropertyDescriptor(desc); + var extensible = IsExtensible(O); + return ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryGetOwnProperty.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryGetOwnProperty.js new file mode 100644 index 00000000..3d11e9fa --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryGetOwnProperty.js @@ -0,0 +1,44 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = require('../helpers/getOwnPropertyDescriptor'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); + +var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); + +var has = require('has'); + +var IsArray = require('./IsArray'); +var IsPropertyKey = require('./IsPropertyKey'); +var IsRegExp = require('./IsRegExp'); +var ToPropertyDescriptor = require('./ToPropertyDescriptor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty + +module.exports = function OrdinaryGetOwnProperty(O, P) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: O must be an Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: P must be a Property Key'); + } + if (!has(O, P)) { + return void 0; + } + if (!$gOPD) { + // ES3 / IE 8 fallback + var arrayLength = IsArray(O) && P === 'length'; + var regexLastIndex = IsRegExp(O) && P === 'lastIndex'; + return { + '[[Configurable]]': !(arrayLength || regexLastIndex), + '[[Enumerable]]': $isEnumerable(O, P), + '[[Value]]': O[P], + '[[Writable]]': true + }; + } + return ToPropertyDescriptor($gOPD(O, P)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryGetPrototypeOf.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryGetPrototypeOf.js new file mode 100644 index 00000000..ba17b988 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryGetPrototypeOf.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var $getProto = require('../helpers/getProto'); + +var Type = require('./Type'); + +// https://262.ecma-international.org/7.0/#sec-ordinarygetprototypeof + +module.exports = function OrdinaryGetPrototypeOf(O) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: O must be an Object'); + } + if (!$getProto) { + throw new $TypeError('This environment does not support fetching prototypes.'); + } + return $getProto(O); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryHasInstance.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryHasInstance.js new file mode 100644 index 00000000..85a240ca --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryHasInstance.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasinstance + +module.exports = function OrdinaryHasInstance(C, O) { + if (IsCallable(C) === false) { + return false; + } + if (Type(O) !== 'Object') { + return false; + } + var P = Get(C, 'prototype'); + if (Type(P) !== 'Object') { + throw new $TypeError('OrdinaryHasInstance called on an object with an invalid prototype property.'); + } + return O instanceof C; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryHasProperty.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryHasProperty.js new file mode 100644 index 00000000..dd09ca3b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryHasProperty.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsPropertyKey = require('./IsPropertyKey'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-ordinaryhasproperty + +module.exports = function OrdinaryHasProperty(O, P) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: P must be a Property Key'); + } + return P in O; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryObjectCreate.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryObjectCreate.js new file mode 100644 index 00000000..34810cd1 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryObjectCreate.js @@ -0,0 +1,46 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $ObjectCreate = GetIntrinsic('%Object.create%', true); +var $TypeError = GetIntrinsic('%TypeError%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); + +var IsArray = require('./IsArray'); +var Type = require('./Type'); + +var hasProto = !({ __proto__: null } instanceof Object); + +// https://262.ecma-international.org/6.0/#sec-objectcreate + +module.exports = function OrdinaryObjectCreate(proto) { + if (proto !== null && Type(proto) !== 'Object') { + throw new $TypeError('Assertion failed: `proto` must be null or an object'); + } + var additionalInternalSlotsList = arguments.length < 2 ? [] : arguments[1]; + if (!IsArray(additionalInternalSlotsList)) { + throw new $TypeError('Assertion failed: `additionalInternalSlotsList` must be an Array'); + } + // var internalSlotsList = ['[[Prototype]]', '[[Extensible]]']; + if (additionalInternalSlotsList.length > 0) { + throw new $SyntaxError('es-abstract does not yet support internal slots'); + // internalSlotsList.push(...additionalInternalSlotsList); + } + // var O = MakeBasicObject(internalSlotsList); + // setProto(O, proto); + // return O; + + if ($ObjectCreate) { + return $ObjectCreate(proto); + } + if (hasProto) { + return { __proto__: proto }; + } + + if (proto === null) { + throw new $SyntaxError('native Object.create support is required to create null objects'); + } + var T = function T() {}; + T.prototype = proto; + return new T(); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinarySetPrototypeOf.js b/docs/snippets/node_modules/es-abstract/2021/OrdinarySetPrototypeOf.js new file mode 100644 index 00000000..d0ff7a7c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinarySetPrototypeOf.js @@ -0,0 +1,53 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var $setProto = require('../helpers/setProto'); + +var OrdinaryGetPrototypeOf = require('./OrdinaryGetPrototypeOf'); +var Type = require('./Type'); + +// https://262.ecma-international.org/7.0/#sec-ordinarysetprototypeof + +module.exports = function OrdinarySetPrototypeOf(O, V) { + if (Type(V) !== 'Object' && Type(V) !== 'Null') { + throw new $TypeError('Assertion failed: V must be Object or Null'); + } + /* + var extensible = IsExtensible(O); + var current = OrdinaryGetPrototypeOf(O); + if (SameValue(V, current)) { + return true; + } + if (!extensible) { + return false; + } + */ + try { + $setProto(O, V); + } catch (e) { + return false; + } + return OrdinaryGetPrototypeOf(O) === V; + /* + var p = V; + var done = false; + while (!done) { + if (p === null) { + done = true; + } else if (SameValue(p, O)) { + return false; + } else { + if (wat) { + done = true; + } else { + p = p.[[Prototype]]; + } + } + } + O.[[Prototype]] = V; + return true; + */ +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/OrdinaryToPrimitive.js b/docs/snippets/node_modules/es-abstract/2021/OrdinaryToPrimitive.js new file mode 100644 index 00000000..e1dbe142 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/OrdinaryToPrimitive.js @@ -0,0 +1,38 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Call = require('./Call'); +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +var inspect = require('object-inspect'); + +// https://262.ecma-international.org/8.0/#sec-ordinarytoprimitive + +module.exports = function OrdinaryToPrimitive(O, hint) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (/* Type(hint) !== 'String' || */ hint !== 'string' && hint !== 'number') { + throw new $TypeError('Assertion failed: `hint` must be "string" or "number"'); + } + + var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString']; + + for (var i = 0; i < methodNames.length; i += 1) { + var name = methodNames[i]; + var method = Get(O, name); + if (IsCallable(method)) { + var result = Call(method, O); + if (Type(result) !== 'Object') { + return result; + } + } + } + + throw new $TypeError('No primitive value for ' + inspect(O)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/PromiseResolve.js b/docs/snippets/node_modules/es-abstract/2021/PromiseResolve.js new file mode 100644 index 00000000..6474b79c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/PromiseResolve.js @@ -0,0 +1,17 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBind = require('call-bind'); + +var $resolve = GetIntrinsic('%Promise.resolve%', true); +var $PromiseResolve = $resolve && callBind($resolve); + +// https://262.ecma-international.org/9.0/#sec-promise-resolve + +module.exports = function PromiseResolve(C, x) { + if (!$PromiseResolve) { + throw new SyntaxError('This environment does not support Promises.'); + } + return $PromiseResolve(C, x); +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/QuoteJSONString.js b/docs/snippets/node_modules/es-abstract/2021/QuoteJSONString.js new file mode 100644 index 00000000..0deebecf --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/QuoteJSONString.js @@ -0,0 +1,54 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); +var forEach = require('../helpers/forEach'); +var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); +var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); + +var $charCodeAt = callBound('String.prototype.charCodeAt'); + +var StringToCodePoints = require('./StringToCodePoints'); +var Type = require('./Type'); +var UnicodeEscape = require('./UnicodeEscape'); +var UTF16EncodeCodePoint = require('./UTF16EncodeCodePoint'); + +var has = require('has'); + +// https://ecma-international.org/ecma-262/12.0/#sec-quotejsonstring + +var escapes = { + '\u0008': '\\b', + '\u0009': '\\t', + '\u000A': '\\n', + '\u000C': '\\f', + '\u000D': '\\r', + '\u0022': '\\"', + '\u005c': '\\\\' +}; + +module.exports = function QuoteJSONString(value) { + if (Type(value) !== 'String') { + throw new $TypeError('Assertion failed: `value` must be a String'); + } + var product = '"'; + if (value) { + forEach(StringToCodePoints(value), function (C) { + if (has(escapes, C)) { + product += escapes[C]; + } else { + var cCharCode = $charCodeAt(C, 0); + if (cCharCode < 0x20 || isLeadingSurrogate(C) || isTrailingSurrogate(C)) { + product += UnicodeEscape(C); + } else { + product += UTF16EncodeCodePoint(cCharCode); + } + } + }); + } + product += '"'; + return product; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/RegExpCreate.js b/docs/snippets/node_modules/es-abstract/2021/RegExpCreate.js new file mode 100644 index 00000000..68e31605 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/RegExpCreate.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $RegExp = GetIntrinsic('%RegExp%'); + +// var RegExpAlloc = require('./RegExpAlloc'); +// var RegExpInitialize = require('./RegExpInitialize'); +var ToString = require('./ToString'); + +// https://262.ecma-international.org/6.0/#sec-regexpcreate + +module.exports = function RegExpCreate(P, F) { + // var obj = RegExpAlloc($RegExp); + // return RegExpInitialize(obj, P, F); + + // covers spec mechanics; bypass regex brand checking + var pattern = typeof P === 'undefined' ? '' : ToString(P); + var flags = typeof F === 'undefined' ? '' : ToString(F); + return new $RegExp(pattern, flags); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/RegExpExec.js b/docs/snippets/node_modules/es-abstract/2021/RegExpExec.js new file mode 100644 index 00000000..29fee172 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/RegExpExec.js @@ -0,0 +1,32 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var regexExec = require('call-bind/callBound')('RegExp.prototype.exec'); + +var Call = require('./Call'); +var Get = require('./Get'); +var IsCallable = require('./IsCallable'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-regexpexec + +module.exports = function RegExpExec(R, S) { + if (Type(R) !== 'Object') { + throw new $TypeError('Assertion failed: `R` must be an Object'); + } + if (Type(S) !== 'String') { + throw new $TypeError('Assertion failed: `S` must be a String'); + } + var exec = Get(R, 'exec'); + if (IsCallable(exec)) { + var result = Call(exec, R, [S]); + if (result === null || Type(result) === 'Object') { + return result; + } + throw new $TypeError('"exec" method must return `null` or an Object'); + } + return regexExec(R, S); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/RequireObjectCoercible.js b/docs/snippets/node_modules/es-abstract/2021/RequireObjectCoercible.js new file mode 100644 index 00000000..9008359d --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/RequireObjectCoercible.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../5/CheckObjectCoercible'); diff --git a/docs/snippets/node_modules/es-abstract/2021/SameValue.js b/docs/snippets/node_modules/es-abstract/2021/SameValue.js new file mode 100644 index 00000000..b73939b2 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SameValue.js @@ -0,0 +1,13 @@ +'use strict'; + +var $isNaN = require('../helpers/isNaN'); + +// http://262.ecma-international.org/5.1/#sec-9.12 + +module.exports = function SameValue(x, y) { + if (x === y) { // 0 === -0, but they are not identical. + if (x === 0) { return 1 / x === 1 / y; } + return true; + } + return $isNaN(x) && $isNaN(y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SameValueNonNumeric.js b/docs/snippets/node_modules/es-abstract/2021/SameValueNonNumeric.js new file mode 100644 index 00000000..f7ef12c0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SameValueNonNumeric.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var SameValue = require('./SameValue'); +var Type = require('./Type'); + +// https://262.ecma-international.org/11.0/#sec-samevaluenonnumeric + +module.exports = function SameValueNonNumeric(x, y) { + var xType = Type(x); + if (xType === 'Number' || xType === 'Bigint') { + throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); + } + if (xType !== Type(y)) { + throw new $TypeError('SameValueNonNumeric requires two non-numeric values of the same type.'); + } + return SameValue(x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SameValueZero.js b/docs/snippets/node_modules/es-abstract/2021/SameValueZero.js new file mode 100644 index 00000000..bf1a1486 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SameValueZero.js @@ -0,0 +1,9 @@ +'use strict'; + +var $isNaN = require('../helpers/isNaN'); + +// https://ecma-international.org/ecma-262/6.0/#sec-samevaluezero + +module.exports = function SameValueZero(x, y) { + return (x === y) || ($isNaN(x) && $isNaN(y)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SecFromTime.js b/docs/snippets/node_modules/es-abstract/2021/SecFromTime.js new file mode 100644 index 00000000..fc2e4456 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SecFromTime.js @@ -0,0 +1,14 @@ +'use strict'; + +var floor = require('./floor'); +var modulo = require('./modulo'); + +var timeConstants = require('../helpers/timeConstants'); +var msPerSecond = timeConstants.msPerSecond; +var SecondsPerMinute = timeConstants.SecondsPerMinute; + +// https://262.ecma-international.org/5.1/#sec-15.9.1.10 + +module.exports = function SecFromTime(t) { + return modulo(floor(t / msPerSecond), SecondsPerMinute); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Set.js b/docs/snippets/node_modules/es-abstract/2021/Set.js new file mode 100644 index 00000000..09714988 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Set.js @@ -0,0 +1,47 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsPropertyKey = require('./IsPropertyKey'); +var SameValue = require('./SameValue'); +var Type = require('./Type'); + +// IE 9 does not throw in strict mode when writability/configurability/extensibility is violated +var noThrowOnStrictViolation = (function () { + try { + delete [].length; + return true; + } catch (e) { + return false; + } +}()); + +// https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw + +module.exports = function Set(O, P, V, Throw) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: `O` must be an Object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: `P` must be a Property Key'); + } + if (Type(Throw) !== 'Boolean') { + throw new $TypeError('Assertion failed: `Throw` must be a Boolean'); + } + if (Throw) { + O[P] = V; // eslint-disable-line no-param-reassign + if (noThrowOnStrictViolation && !SameValue(O[P], V)) { + throw new $TypeError('Attempted to assign to readonly property.'); + } + return true; + } + try { + O[P] = V; // eslint-disable-line no-param-reassign + return noThrowOnStrictViolation ? SameValue(O[P], V) : true; + } catch (e) { + return false; + } + +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SetFunctionLength.js b/docs/snippets/node_modules/es-abstract/2021/SetFunctionLength.js new file mode 100644 index 00000000..8c06b242 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SetFunctionLength.js @@ -0,0 +1,31 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); +var HasOwnProperty = require('./HasOwnProperty'); +var IsExtensible = require('./IsExtensible'); +var IsIntegralNumber = require('./IsIntegralNumber'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/12.0/#sec-setfunctionlength + +module.exports = function SetFunctionLength(F, length) { + if (typeof F !== 'function' || !IsExtensible(F) || HasOwnProperty(F, 'length')) { + throw new $TypeError('Assertion failed: `F` must be an extensible function and lack an own `length` property'); + } + if (Type(length) !== 'Number') { + throw new $TypeError('Assertion failed: `length` must be a Number'); + } + if (length !== Infinity && (!IsIntegralNumber(length) || length < 0)) { + throw new $TypeError('Assertion failed: `length` must be ∞, or an integer >= 0'); + } + return DefinePropertyOrThrow(F, 'length', { + '[[Configurable]]': true, + '[[Enumerable]]': false, + '[[Value]]': length, + '[[Writable]]': false + }); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SetFunctionName.js b/docs/snippets/node_modules/es-abstract/2021/SetFunctionName.js new file mode 100644 index 00000000..03ec2227 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SetFunctionName.js @@ -0,0 +1,44 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var has = require('has'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var getSymbolDescription = require('get-symbol-description'); + +var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); +var IsExtensible = require('./IsExtensible'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-setfunctionname + +module.exports = function SetFunctionName(F, name) { + if (typeof F !== 'function') { + throw new $TypeError('Assertion failed: `F` must be a function'); + } + if (!IsExtensible(F) || has(F, 'name')) { + throw new $TypeError('Assertion failed: `F` must be extensible, and must not have a `name` own property'); + } + var nameType = Type(name); + if (nameType !== 'Symbol' && nameType !== 'String') { + throw new $TypeError('Assertion failed: `name` must be a Symbol or a String'); + } + if (nameType === 'Symbol') { + var description = getSymbolDescription(name); + // eslint-disable-next-line no-param-reassign + name = typeof description === 'undefined' ? '' : '[' + description + ']'; + } + if (arguments.length > 2) { + var prefix = arguments[2]; + // eslint-disable-next-line no-param-reassign + name = prefix + ' ' + name; + } + return DefinePropertyOrThrow(F, 'name', { + '[[Value]]': name, + '[[Writable]]': false, + '[[Enumerable]]': false, + '[[Configurable]]': true + }); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SetIntegrityLevel.js b/docs/snippets/node_modules/es-abstract/2021/SetIntegrityLevel.js new file mode 100644 index 00000000..1ac7d61e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SetIntegrityLevel.js @@ -0,0 +1,57 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var $TypeError = GetIntrinsic('%TypeError%'); +var $preventExtensions = GetIntrinsic('%Object.preventExtensions%'); +var $gOPD = require('../helpers/getOwnPropertyDescriptor'); +var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%'); + +var forEach = require('../helpers/forEach'); + +var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); +var IsAccessorDescriptor = require('./IsAccessorDescriptor'); +var ToPropertyDescriptor = require('./ToPropertyDescriptor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-setintegritylevel + +module.exports = function SetIntegrityLevel(O, level) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (level !== 'sealed' && level !== 'frozen') { + throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); + } + if (!$preventExtensions) { + throw new $SyntaxError('SetIntegrityLevel requires native `Object.preventExtensions` support'); + } + var status = $preventExtensions(O); + if (!status) { + return false; + } + if (!$gOPN) { + throw new $SyntaxError('SetIntegrityLevel requires native `Object.getOwnPropertyNames` support'); + } + var theKeys = $gOPN(O); + if (level === 'sealed') { + forEach(theKeys, function (k) { + DefinePropertyOrThrow(O, k, { configurable: false }); + }); + } else if (level === 'frozen') { + forEach(theKeys, function (k) { + var currentDesc = $gOPD(O, k); + if (typeof currentDesc !== 'undefined') { + var desc; + if (IsAccessorDescriptor(ToPropertyDescriptor(currentDesc))) { + desc = { configurable: false }; + } else { + desc = { configurable: false, writable: false }; + } + DefinePropertyOrThrow(O, k, desc); + } + }); + } + return true; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SpeciesConstructor.js b/docs/snippets/node_modules/es-abstract/2021/SpeciesConstructor.js new file mode 100644 index 00000000..491eb9b8 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SpeciesConstructor.js @@ -0,0 +1,32 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $species = GetIntrinsic('%Symbol.species%', true); +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsConstructor = require('./IsConstructor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor + +module.exports = function SpeciesConstructor(O, defaultConstructor) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + var C = O.constructor; + if (typeof C === 'undefined') { + return defaultConstructor; + } + if (Type(C) !== 'Object') { + throw new $TypeError('O.constructor is not an Object'); + } + var S = $species ? C[$species] : void 0; + if (S == null) { + return defaultConstructor; + } + if (IsConstructor(S)) { + return S; + } + throw new $TypeError('no constructor found'); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SplitMatch.js b/docs/snippets/node_modules/es-abstract/2021/SplitMatch.js new file mode 100644 index 00000000..a1bc6c4d --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SplitMatch.js @@ -0,0 +1,38 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsIntegralNumber = require('./IsIntegralNumber'); +var Type = require('./Type'); + +var $charAt = callBound('String.prototype.charAt'); + +// https://262.ecma-international.org/6.0/#sec-splitmatch + +module.exports = function SplitMatch(S, q, R) { + if (Type(S) !== 'String') { + throw new $TypeError('Assertion failed: `S` must be a String'); + } + if (!IsIntegralNumber(q)) { + throw new $TypeError('Assertion failed: `q` must be an integer'); + } + if (Type(R) !== 'String') { + throw new $TypeError('Assertion failed: `R` must be a String'); + } + var r = R.length; + var s = S.length; + if (q + r > s) { + return false; + } + + for (var i = 0; i < r; i += 1) { + if ($charAt(S, q + i) !== $charAt(R, i)) { + return false; + } + } + + return q + r; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/StrictEqualityComparison.js b/docs/snippets/node_modules/es-abstract/2021/StrictEqualityComparison.js new file mode 100644 index 00000000..f3435ba9 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/StrictEqualityComparison.js @@ -0,0 +1,17 @@ +'use strict'; + +var Type = require('./Type'); + +// https://262.ecma-international.org/5.1/#sec-11.9.6 + +module.exports = function StrictEqualityComparison(x, y) { + var xType = Type(x); + var yType = Type(y); + if (xType !== yType) { + return false; + } + if (xType === 'Undefined' || xType === 'Null') { + return true; + } + return x === y; // shortcut for steps 4-7 +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/StringCreate.js b/docs/snippets/node_modules/es-abstract/2021/StringCreate.js new file mode 100644 index 00000000..da0c0ea0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/StringCreate.js @@ -0,0 +1,40 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Object = GetIntrinsic('%Object%'); +var $StringPrototype = GetIntrinsic('%String.prototype%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var DefinePropertyOrThrow = require('./DefinePropertyOrThrow'); +var Type = require('./Type'); + +var setProto = require('../helpers/setProto'); + +// https://262.ecma-international.org/6.0/#sec-stringcreate + +module.exports = function StringCreate(value, prototype) { + if (Type(value) !== 'String') { + throw new $TypeError('Assertion failed: `S` must be a String'); + } + + var S = $Object(value); + if (S !== $StringPrototype) { + if (setProto) { + setProto(S, prototype); + } else { + throw new $SyntaxError('StringCreate: a `proto` argument that is not `String.prototype` is not supported in an environment that does not support setting the [[Prototype]]'); + } + } + + var length = value.length; + DefinePropertyOrThrow(S, 'length', { + '[[Configurable]]': false, + '[[Enumerable]]': false, + '[[Value]]': length, + '[[Writable]]': false + }); + + return S; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/StringGetOwnProperty.js b/docs/snippets/node_modules/es-abstract/2021/StringGetOwnProperty.js new file mode 100644 index 00000000..ecffb0b7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/StringGetOwnProperty.js @@ -0,0 +1,48 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); +var $charAt = callBound('String.prototype.charAt'); +var $stringToString = callBound('String.prototype.toString'); + +var CanonicalNumericIndexString = require('./CanonicalNumericIndexString'); +var IsIntegralNumber = require('./IsIntegralNumber'); +var IsPropertyKey = require('./IsPropertyKey'); +var Type = require('./Type'); + +var isNegativeZero = require('is-negative-zero'); + +// https://ecma-international.org/ecma-262/12.0/#sec-stringgetownproperty + +module.exports = function StringGetOwnProperty(S, P) { + var str; + if (Type(S) === 'Object') { + try { + str = $stringToString(S); + } catch (e) { /**/ } + } + if (Type(str) !== 'String') { + throw new $TypeError('Assertion failed: `S` must be a boxed string object'); + } + if (!IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true'); + } + if (Type(P) !== 'String') { + return void undefined; + } + var index = CanonicalNumericIndexString(P); + var len = str.length; + if (typeof index === 'undefined' || !IsIntegralNumber(index) || isNegativeZero(index) || index < 0 || len <= index) { + return void undefined; + } + var resultStr = $charAt(S, index); + return { + '[[Configurable]]': false, + '[[Enumerable]]': true, + '[[Value]]': resultStr, + '[[Writable]]': false + }; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/StringIndexOf.js b/docs/snippets/node_modules/es-abstract/2021/StringIndexOf.js new file mode 100644 index 00000000..371d5aa3 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/StringIndexOf.js @@ -0,0 +1,39 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsIntegralNumber = require('./IsIntegralNumber'); +var Type = require('./Type'); + +var $slice = callBound('String.prototype.slice'); + +// https://ecma-international.org/ecma-262/12.0/#sec-stringindexof + +module.exports = function StringIndexOf(string, searchValue, fromIndex) { + if (Type(string) !== 'String') { + throw new $TypeError('Assertion failed: `string` must be a String'); + } + if (Type(searchValue) !== 'String') { + throw new $TypeError('Assertion failed: `searchValue` must be a String'); + } + if (!IsIntegralNumber(fromIndex) || fromIndex < 0) { + throw new $TypeError('Assertion failed: `fromIndex` must be a non-negative integer'); + } + + var len = string.length; + if (searchValue === '' && fromIndex <= len) { + return fromIndex; + } + + var searchLen = searchValue.length; + for (var i = fromIndex; i <= (len - searchLen); i += 1) { + var candidate = $slice(string, i, i + searchLen); + if (candidate === searchValue) { + return i; + } + } + return -1; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/StringPad.js b/docs/snippets/node_modules/es-abstract/2021/StringPad.js new file mode 100644 index 00000000..cdf69001 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/StringPad.js @@ -0,0 +1,43 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); + +var ToLength = require('./ToLength'); +var ToString = require('./ToString'); + +var $strSlice = callBound('String.prototype.slice'); + +// https://262.ecma-international.org/11.0/#sec-stringpad + +module.exports = function StringPad(O, maxLength, fillString, placement) { + if (placement !== 'start' && placement !== 'end') { + throw new $TypeError('Assertion failed: `placement` must be "start" or "end"'); + } + var S = ToString(O); + var intMaxLength = ToLength(maxLength); + var stringLength = S.length; + if (intMaxLength <= stringLength) { + return S; + } + var filler = typeof fillString === 'undefined' ? ' ' : ToString(fillString); + if (filler === '') { + return S; + } + var fillLen = intMaxLength - stringLength; + + // the String value consisting of repeated concatenations of filler truncated to length fillLen. + var truncatedStringFiller = ''; + while (truncatedStringFiller.length < fillLen) { + truncatedStringFiller += filler; + } + truncatedStringFiller = $strSlice(truncatedStringFiller, 0, fillLen); + + if (placement === 'start') { + return truncatedStringFiller + S; + } + return S + truncatedStringFiller; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/StringToBigInt.js b/docs/snippets/node_modules/es-abstract/2021/StringToBigInt.js new file mode 100644 index 00000000..0bc3cec0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/StringToBigInt.js @@ -0,0 +1,23 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $TypeError = GetIntrinsic('%TypeError%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); + +// https://262.ecma-international.org/11.0/#sec-stringtobigint + +module.exports = function StringToBigInt(argument) { + if (typeof argument !== 'string') { + throw new $TypeError('`argument` must be a string'); + } + if (!$BigInt) { + throw new $SyntaxError('BigInts are not supported in this environment'); + } + try { + return $BigInt(argument); + } catch (e) { + return NaN; + } +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/StringToCodePoints.js b/docs/snippets/node_modules/es-abstract/2021/StringToCodePoints.js new file mode 100644 index 00000000..336bd06f --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/StringToCodePoints.js @@ -0,0 +1,29 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); + +var $push = callBound('Array.prototype.push'); + +var CodePointAt = require('./CodePointAt'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/12.0/#sec-stringtocodepoints + +module.exports = function StringToCodePoints(string) { + if (Type(string) !== 'String') { + throw new $TypeError('Assertion failed: `string` must be a String'); + } + var codePoints = []; + var size = string.length; + var position = 0; + while (position < size) { + var cp = CodePointAt(string, position); + $push(codePoints, cp['[[CodePoint]]']); + position += cp['[[CodeUnitCount]]']; + } + return codePoints; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/SymbolDescriptiveString.js b/docs/snippets/node_modules/es-abstract/2021/SymbolDescriptiveString.js new file mode 100644 index 00000000..1efd1316 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/SymbolDescriptiveString.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); + +var $SymbolToString = callBound('Symbol.prototype.toString', true); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-symboldescriptivestring + +module.exports = function SymbolDescriptiveString(sym) { + if (Type(sym) !== 'Symbol') { + throw new $TypeError('Assertion failed: `sym` must be a Symbol'); + } + return $SymbolToString(sym); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/TestIntegrityLevel.js b/docs/snippets/node_modules/es-abstract/2021/TestIntegrityLevel.js new file mode 100644 index 00000000..cf1649c1 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/TestIntegrityLevel.js @@ -0,0 +1,42 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = require('../helpers/getOwnPropertyDescriptor'); +var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +var every = require('../helpers/every'); + +var IsDataDescriptor = require('./IsDataDescriptor'); +var IsExtensible = require('./IsExtensible'); +var ToPropertyDescriptor = require('./ToPropertyDescriptor'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-testintegritylevel + +module.exports = function TestIntegrityLevel(O, level) { + if (Type(O) !== 'Object') { + throw new $TypeError('Assertion failed: Type(O) is not Object'); + } + if (level !== 'sealed' && level !== 'frozen') { + throw new $TypeError('Assertion failed: `level` must be `"sealed"` or `"frozen"`'); + } + var status = IsExtensible(O); + if (status) { + return false; + } + var theKeys = $gOPN(O); + return theKeys.length === 0 || every(theKeys, function (k) { + var currentDesc = $gOPD(O, k); + if (typeof currentDesc !== 'undefined') { + if (currentDesc.configurable) { + return false; + } + if (level === 'frozen' && IsDataDescriptor(ToPropertyDescriptor(currentDesc)) && currentDesc.writable) { + return false; + } + } + return true; + }); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/TimeClip.js b/docs/snippets/node_modules/es-abstract/2021/TimeClip.js new file mode 100644 index 00000000..e416cab4 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/TimeClip.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Date = GetIntrinsic('%Date%'); +var $Number = GetIntrinsic('%Number%'); + +var $isFinite = require('../helpers/isFinite'); + +var abs = require('./abs'); +var ToNumber = require('./ToNumber'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.14 + +module.exports = function TimeClip(time) { + if (!$isFinite(time) || abs(time) > 8.64e15) { + return NaN; + } + return $Number(new $Date(ToNumber(time))); +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/TimeFromYear.js b/docs/snippets/node_modules/es-abstract/2021/TimeFromYear.js new file mode 100644 index 00000000..f3518a41 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/TimeFromYear.js @@ -0,0 +1,11 @@ +'use strict'; + +var msPerDay = require('../helpers/timeConstants').msPerDay; + +var DayFromYear = require('./DayFromYear'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.3 + +module.exports = function TimeFromYear(y) { + return msPerDay * DayFromYear(y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/TimeString.js b/docs/snippets/node_modules/es-abstract/2021/TimeString.js new file mode 100644 index 00000000..051c4728 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/TimeString.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var $isNaN = require('../helpers/isNaN'); +var padTimeComponent = require('../helpers/padTimeComponent'); + +var HourFromTime = require('./HourFromTime'); +var MinFromTime = require('./MinFromTime'); +var SecFromTime = require('./SecFromTime'); +var Type = require('./Type'); + +// https://262.ecma-international.org/9.0/#sec-timestring + +module.exports = function TimeString(tv) { + if (Type(tv) !== 'Number' || $isNaN(tv)) { + throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number'); + } + var hour = HourFromTime(tv); + var minute = MinFromTime(tv); + var second = SecFromTime(tv); + return padTimeComponent(hour) + ':' + padTimeComponent(minute) + ':' + padTimeComponent(second) + '\x20GMT'; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/TimeWithinDay.js b/docs/snippets/node_modules/es-abstract/2021/TimeWithinDay.js new file mode 100644 index 00000000..2bba8338 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/TimeWithinDay.js @@ -0,0 +1,12 @@ +'use strict'; + +var modulo = require('./modulo'); + +var msPerDay = require('../helpers/timeConstants').msPerDay; + +// https://262.ecma-international.org/5.1/#sec-15.9.1.2 + +module.exports = function TimeWithinDay(t) { + return modulo(t, msPerDay); +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/ToBigInt.js b/docs/snippets/node_modules/es-abstract/2021/ToBigInt.js new file mode 100644 index 00000000..aa24d7b7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToBigInt.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $asIntN = GetIntrinsic('%BigInt.asIntN%', true); +var $Number = GetIntrinsic('%Number%'); +var $SyntaxError = GetIntrinsic('%SyntaxError%'); + +var ToPrimitive = require('./ToPrimitive'); + +// https://262.ecma-international.org/11.0/#sec-tobigint + +module.exports = function ToBigInt(argument) { + if (!$BigInt) { + throw new $SyntaxError('BigInts are not supported in this environment'); + } + + var prim = ToPrimitive(argument, $Number); + + if (typeof prim === 'number') { + return $asIntN(0, prim); + } + return $BigInt(prim); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToBigInt64.js b/docs/snippets/node_modules/es-abstract/2021/ToBigInt64.js new file mode 100644 index 00000000..65c1c55d --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToBigInt64.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $pow = GetIntrinsic('%Math.pow%'); + +var ToBigInt = require('./ToBigInt'); +var BigIntRemainder = require('./BigInt/remainder'); + +var modBigInt = require('../helpers/modBigInt'); + +// BigInt(2**63), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER +var twoSixtyThree = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 31))); + +// BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER +var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); + +// https://262.ecma-international.org/11.0/#sec-tobigint64 + +module.exports = function ToBigInt64(argument) { + var n = ToBigInt(argument); + var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); + return int64bit >= twoSixtyThree ? int64bit - twoSixtyFour : int64bit; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToBigUint64.js b/docs/snippets/node_modules/es-abstract/2021/ToBigUint64.js new file mode 100644 index 00000000..ff68236a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToBigUint64.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $BigInt = GetIntrinsic('%BigInt%', true); +var $pow = GetIntrinsic('%Math.pow%'); + +var ToBigInt = require('./ToBigInt'); +var BigIntRemainder = require('./BigInt/remainder'); + +var modBigInt = require('../helpers/modBigInt'); + +// BigInt(2**64), but node v10.4-v10.8 have a bug where you can't `BigInt(x)` anything larger than MAX_SAFE_INTEGER +var twoSixtyFour = $BigInt && (BigInt($pow(2, 32)) * BigInt($pow(2, 32))); + +// https://262.ecma-international.org/11.0/#sec-tobiguint64 + +module.exports = function ToBigUint64(argument) { + var n = ToBigInt(argument); + var int64bit = modBigInt(BigIntRemainder, n, twoSixtyFour); + return int64bit; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToBoolean.js b/docs/snippets/node_modules/es-abstract/2021/ToBoolean.js new file mode 100644 index 00000000..466404bf --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToBoolean.js @@ -0,0 +1,5 @@ +'use strict'; + +// http://262.ecma-international.org/5.1/#sec-9.2 + +module.exports = function ToBoolean(value) { return !!value; }; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToDateString.js b/docs/snippets/node_modules/es-abstract/2021/ToDateString.js new file mode 100644 index 00000000..e636a9ba --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToDateString.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $Date = GetIntrinsic('%Date%'); + +var $isNaN = require('../helpers/isNaN'); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-todatestring + +module.exports = function ToDateString(tv) { + if (Type(tv) !== 'Number') { + throw new $TypeError('Assertion failed: `tv` must be a Number'); + } + if ($isNaN(tv)) { + return 'Invalid Date'; + } + return $Date(tv); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToIndex.js b/docs/snippets/node_modules/es-abstract/2021/ToIndex.js new file mode 100644 index 00000000..cc747e22 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToIndex.js @@ -0,0 +1,26 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $RangeError = GetIntrinsic('%RangeError%'); + +var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); +var ToLength = require('./ToLength'); +var SameValue = require('./SameValue'); + +// https://www.ecma-international.org/ecma-262/8.0/#sec-toindex + +module.exports = function ToIndex(value) { + if (typeof value === 'undefined') { + return 0; + } + var integerIndex = ToIntegerOrInfinity(value); + if (integerIndex < 0) { + throw new $RangeError('index must be >= 0'); + } + var index = ToLength(integerIndex); + if (!SameValue(integerIndex, index)) { + throw new $RangeError('index must be >= 0 and < 2 ** 53 - 1'); + } + return index; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToInt16.js b/docs/snippets/node_modules/es-abstract/2021/ToInt16.js new file mode 100644 index 00000000..cb8e7934 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToInt16.js @@ -0,0 +1,10 @@ +'use strict'; + +var ToUint16 = require('./ToUint16'); + +// https://ecma-international.org/ecma-262/6.0/#sec-toint16 + +module.exports = function ToInt16(argument) { + var int16bit = ToUint16(argument); + return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToInt32.js b/docs/snippets/node_modules/es-abstract/2021/ToInt32.js new file mode 100644 index 00000000..b879ccc4 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToInt32.js @@ -0,0 +1,9 @@ +'use strict'; + +var ToNumber = require('./ToNumber'); + +// http://262.ecma-international.org/5.1/#sec-9.5 + +module.exports = function ToInt32(x) { + return ToNumber(x) >> 0; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToInt8.js b/docs/snippets/node_modules/es-abstract/2021/ToInt8.js new file mode 100644 index 00000000..bc452d82 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToInt8.js @@ -0,0 +1,10 @@ +'use strict'; + +var ToUint8 = require('./ToUint8'); + +// https://ecma-international.org/ecma-262/6.0/#sec-toint8 + +module.exports = function ToInt8(argument) { + var int8bit = ToUint8(argument); + return int8bit >= 0x80 ? int8bit - 0x100 : int8bit; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToIntegerOrInfinity.js b/docs/snippets/node_modules/es-abstract/2021/ToIntegerOrInfinity.js new file mode 100644 index 00000000..967713c5 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToIntegerOrInfinity.js @@ -0,0 +1,15 @@ +'use strict'; + +var ES5ToInteger = require('../5/ToInteger'); + +var ToNumber = require('./ToNumber'); + +// https://www.ecma-international.org/ecma-262/11.0/#sec-tointeger + +module.exports = function ToInteger(value) { + var number = ToNumber(value); + if (number !== 0) { + number = ES5ToInteger(number); + } + return number === 0 ? 0 : number; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToLength.js b/docs/snippets/node_modules/es-abstract/2021/ToLength.js new file mode 100644 index 00000000..0468c3e7 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToLength.js @@ -0,0 +1,12 @@ +'use strict'; + +var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); + +var ToIntegerOrInfinity = require('./ToIntegerOrInfinity'); + +module.exports = function ToLength(argument) { + var len = ToIntegerOrInfinity(argument); + if (len <= 0) { return 0; } // includes converting -0 to +0 + if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } + return len; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToNumber.js b/docs/snippets/node_modules/es-abstract/2021/ToNumber.js new file mode 100644 index 00000000..3b00377a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToNumber.js @@ -0,0 +1,62 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $Number = GetIntrinsic('%Number%'); +var $RegExp = GetIntrinsic('%RegExp%'); +var $parseInteger = GetIntrinsic('%parseInt%'); + +var callBound = require('call-bind/callBound'); +var regexTester = require('../helpers/regexTester'); +var isPrimitive = require('../helpers/isPrimitive'); + +var $strSlice = callBound('String.prototype.slice'); +var isBinary = regexTester(/^0b[01]+$/i); +var isOctal = regexTester(/^0o[0-7]+$/i); +var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i); +var nonWS = ['\u0085', '\u200b', '\ufffe'].join(''); +var nonWSregex = new $RegExp('[' + nonWS + ']', 'g'); +var hasNonWS = regexTester(nonWSregex); + +// whitespace from: https://es5.github.io/#x15.5.4.20 +// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324 +var ws = [ + '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003', + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028', + '\u2029\uFEFF' +].join(''); +var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g'); +var $replace = callBound('String.prototype.replace'); +var $trim = function (value) { + return $replace(value, trimRegex, ''); +}; + +var ToPrimitive = require('./ToPrimitive'); + +// https://ecma-international.org/ecma-262/6.0/#sec-tonumber + +module.exports = function ToNumber(argument) { + var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); + if (typeof value === 'symbol') { + throw new $TypeError('Cannot convert a Symbol value to a number'); + } + if (typeof value === 'bigint') { + throw new $TypeError('Conversion from \'BigInt\' to \'number\' is not allowed.'); + } + if (typeof value === 'string') { + if (isBinary(value)) { + return ToNumber($parseInteger($strSlice(value, 2), 2)); + } else if (isOctal(value)) { + return ToNumber($parseInteger($strSlice(value, 2), 8)); + } else if (hasNonWS(value) || isInvalidHexLiteral(value)) { + return NaN; + } + var trimmed = $trim(value); + if (trimmed !== value) { + return ToNumber(trimmed); + } + + } + return $Number(value); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToNumeric.js b/docs/snippets/node_modules/es-abstract/2021/ToNumeric.js new file mode 100644 index 00000000..c1877609 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToNumeric.js @@ -0,0 +1,21 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Number = GetIntrinsic('%Number%'); + +var isPrimitive = require('../helpers/isPrimitive'); + +var ToPrimitive = require('./ToPrimitive'); +var ToNumber = require('./ToNumber'); +var Type = require('./Type'); + +// https://262.ecma-international.org/6.0/#sec-tonumber + +module.exports = function ToNumeric(argument) { + var primValue = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number); + if (Type(primValue) === 'BigInt') { + return primValue; + } + return ToNumber(primValue); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToObject.js b/docs/snippets/node_modules/es-abstract/2021/ToObject.js new file mode 100644 index 00000000..cb26bac0 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToObject.js @@ -0,0 +1,14 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Object = GetIntrinsic('%Object%'); + +var RequireObjectCoercible = require('./RequireObjectCoercible'); + +// https://ecma-international.org/ecma-262/6.0/#sec-toobject + +module.exports = function ToObject(value) { + RequireObjectCoercible(value); + return $Object(value); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToPrimitive.js b/docs/snippets/node_modules/es-abstract/2021/ToPrimitive.js new file mode 100644 index 00000000..0fbe9b80 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToPrimitive.js @@ -0,0 +1,12 @@ +'use strict'; + +var toPrimitive = require('es-to-primitive/es2015'); + +// https://ecma-international.org/ecma-262/6.0/#sec-toprimitive + +module.exports = function ToPrimitive(input) { + if (arguments.length > 1) { + return toPrimitive(input, arguments[1]); + } + return toPrimitive(input); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToPropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/ToPropertyDescriptor.js new file mode 100644 index 00000000..53db8745 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToPropertyDescriptor.js @@ -0,0 +1,52 @@ +'use strict'; + +var has = require('has'); + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var Type = require('./Type'); +var ToBoolean = require('./ToBoolean'); +var IsCallable = require('./IsCallable'); + +// https://262.ecma-international.org/5.1/#sec-8.10.5 + +module.exports = function ToPropertyDescriptor(Obj) { + if (Type(Obj) !== 'Object') { + throw new $TypeError('ToPropertyDescriptor requires an object'); + } + + var desc = {}; + if (has(Obj, 'enumerable')) { + desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable); + } + if (has(Obj, 'configurable')) { + desc['[[Configurable]]'] = ToBoolean(Obj.configurable); + } + if (has(Obj, 'value')) { + desc['[[Value]]'] = Obj.value; + } + if (has(Obj, 'writable')) { + desc['[[Writable]]'] = ToBoolean(Obj.writable); + } + if (has(Obj, 'get')) { + var getter = Obj.get; + if (typeof getter !== 'undefined' && !IsCallable(getter)) { + throw new $TypeError('getter must be a function'); + } + desc['[[Get]]'] = getter; + } + if (has(Obj, 'set')) { + var setter = Obj.set; + if (typeof setter !== 'undefined' && !IsCallable(setter)) { + throw new $TypeError('setter must be a function'); + } + desc['[[Set]]'] = setter; + } + + if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) { + throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute'); + } + return desc; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToPropertyKey.js b/docs/snippets/node_modules/es-abstract/2021/ToPropertyKey.js new file mode 100644 index 00000000..fc1bf7d8 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToPropertyKey.js @@ -0,0 +1,15 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $String = GetIntrinsic('%String%'); + +var ToPrimitive = require('./ToPrimitive'); +var ToString = require('./ToString'); + +// https://ecma-international.org/ecma-262/6.0/#sec-topropertykey + +module.exports = function ToPropertyKey(argument) { + var key = ToPrimitive(argument, $String); + return typeof key === 'symbol' ? key : ToString(key); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToString.js b/docs/snippets/node_modules/es-abstract/2021/ToString.js new file mode 100644 index 00000000..4d494e1e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToString.js @@ -0,0 +1,15 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $String = GetIntrinsic('%String%'); +var $TypeError = GetIntrinsic('%TypeError%'); + +// https://ecma-international.org/ecma-262/6.0/#sec-tostring + +module.exports = function ToString(argument) { + if (typeof argument === 'symbol') { + throw new $TypeError('Cannot convert a Symbol value to a string'); + } + return $String(argument); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToUint16.js b/docs/snippets/node_modules/es-abstract/2021/ToUint16.js new file mode 100644 index 00000000..633ca846 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToUint16.js @@ -0,0 +1,19 @@ +'use strict'; + +var abs = require('./abs'); +var floor = require('./floor'); +var modulo = require('./modulo'); +var ToNumber = require('./ToNumber'); + +var $isNaN = require('../helpers/isNaN'); +var $isFinite = require('../helpers/isFinite'); +var $sign = require('../helpers/sign'); + +// http://262.ecma-international.org/5.1/#sec-9.7 + +module.exports = function ToUint16(value) { + var number = ToNumber(value); + if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } + var posInt = $sign(number) * floor(abs(number)); + return modulo(posInt, 0x10000); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToUint32.js b/docs/snippets/node_modules/es-abstract/2021/ToUint32.js new file mode 100644 index 00000000..2a8e9dd6 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToUint32.js @@ -0,0 +1,9 @@ +'use strict'; + +var ToNumber = require('./ToNumber'); + +// http://262.ecma-international.org/5.1/#sec-9.6 + +module.exports = function ToUint32(x) { + return ToNumber(x) >>> 0; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToUint8.js b/docs/snippets/node_modules/es-abstract/2021/ToUint8.js new file mode 100644 index 00000000..2dfd97cb --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToUint8.js @@ -0,0 +1,20 @@ +'use strict'; + +var ToNumber = require('./ToNumber'); + +var $isNaN = require('../helpers/isNaN'); +var $isFinite = require('../helpers/isFinite'); +var $sign = require('../helpers/sign'); + +var abs = require('./abs'); +var floor = require('./floor'); +var modulo = require('./modulo'); + +// https://ecma-international.org/ecma-262/6.0/#sec-touint8 + +module.exports = function ToUint8(argument) { + var number = ToNumber(argument); + if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; } + var posInt = $sign(number) * floor(abs(number)); + return modulo(posInt, 0x100); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ToUint8Clamp.js b/docs/snippets/node_modules/es-abstract/2021/ToUint8Clamp.js new file mode 100644 index 00000000..b0b8ce8e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ToUint8Clamp.js @@ -0,0 +1,19 @@ +'use strict'; + +var ToNumber = require('./ToNumber'); +var floor = require('./floor'); + +var $isNaN = require('../helpers/isNaN'); + +// https://ecma-international.org/ecma-262/6.0/#sec-touint8clamp + +module.exports = function ToUint8Clamp(argument) { + var number = ToNumber(argument); + if ($isNaN(number) || number <= 0) { return 0; } + if (number >= 0xFF) { return 0xFF; } + var f = floor(argument); + if (f + 0.5 < number) { return f + 1; } + if (number < f + 0.5) { return f; } + if (f % 2 !== 0) { return f + 1; } + return f; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/TrimString.js b/docs/snippets/node_modules/es-abstract/2021/TrimString.js new file mode 100644 index 00000000..113dcf82 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/TrimString.js @@ -0,0 +1,29 @@ +'use strict'; + +var trimStart = require('string.prototype.trimstart'); +var trimEnd = require('string.prototype.trimend'); + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var RequireObjectCoercible = require('./RequireObjectCoercible'); +var ToString = require('./ToString'); + +// https://262.ecma-international.org/10.0/#sec-trimstring + +module.exports = function TrimString(string, where) { + var str = RequireObjectCoercible(string); + var S = ToString(str); + var T; + if (where === 'start') { + T = trimStart(S); + } else if (where === 'end') { + T = trimEnd(S); + } else if (where === 'start+end') { + T = trimStart(trimEnd(S)); + } else { + throw new $TypeError('Assertion failed: invalid `where` value; must be "start", "end", or "start+end"'); + } + return T; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/Type.js b/docs/snippets/node_modules/es-abstract/2021/Type.js new file mode 100644 index 00000000..555ca74e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/Type.js @@ -0,0 +1,15 @@ +'use strict'; + +var ES5Type = require('../5/Type'); + +// https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values + +module.exports = function Type(x) { + if (typeof x === 'symbol') { + return 'Symbol'; + } + if (typeof x === 'bigint') { + return 'BigInt'; + } + return ES5Type(x); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/UTF16EncodeCodePoint.js b/docs/snippets/node_modules/es-abstract/2021/UTF16EncodeCodePoint.js new file mode 100644 index 00000000..0c7fb11e --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/UTF16EncodeCodePoint.js @@ -0,0 +1,25 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); + +var floor = require('./floor'); +var modulo = require('./modulo'); + +var isCodePoint = require('../helpers/isCodePoint'); + +// https://ecma-international.org/ecma-262/12.0/#sec-utf16encoding + +module.exports = function UTF16EncodeCodePoint(cp) { + if (!isCodePoint(cp)) { + throw new $TypeError('Assertion failed: `cp` must be >= 0 and <= 0x10FFFF'); + } + if (cp <= 65535) { + return $fromCharCode(cp); + } + var cu1 = $fromCharCode(floor((cp - 65536) / 1024) + 0xD800); + var cu2 = $fromCharCode(modulo(cp - 65536, 1024) + 0xDC00); + return cu1 + cu2; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/UTF16SurrogatePairToCodePoint.js b/docs/snippets/node_modules/es-abstract/2021/UTF16SurrogatePairToCodePoint.js new file mode 100644 index 00000000..7a50f316 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/UTF16SurrogatePairToCodePoint.js @@ -0,0 +1,19 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $fromCharCode = GetIntrinsic('%String.fromCharCode%'); + +var isLeadingSurrogate = require('../helpers/isLeadingSurrogate'); +var isTrailingSurrogate = require('../helpers/isTrailingSurrogate'); + +// https://tc39.es/ecma262/2020/#sec-utf16decodesurrogatepair + +module.exports = function UTF16DecodeSurrogatePair(lead, trail) { + if (!isLeadingSurrogate(lead) || !isTrailingSurrogate(trail)) { + throw new $TypeError('Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code'); + } + // var cp = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000; + return $fromCharCode(lead) + $fromCharCode(trail); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/UnicodeEscape.js b/docs/snippets/node_modules/es-abstract/2021/UnicodeEscape.js new file mode 100644 index 00000000..b708c90d --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/UnicodeEscape.js @@ -0,0 +1,27 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var callBound = require('call-bind/callBound'); + +var $charCodeAt = callBound('String.prototype.charCodeAt'); +var $numberToString = callBound('Number.prototype.toString'); +var $toLowerCase = callBound('String.prototype.toLowerCase'); + +var StringPad = require('./StringPad'); + +// https://262.ecma-international.org/11.0/#sec-unicodeescape + +module.exports = function UnicodeEscape(C) { + if (typeof C !== 'string' || C.length !== 1) { + throw new $TypeError('Assertion failed: `C` must be a single code unit'); + } + var n = $charCodeAt(C, 0); + if (n > 0xFFFF) { + throw new $TypeError('`Assertion failed: numeric value of `C` must be <= 0xFFFF'); + } + + return '\\u' + StringPad($toLowerCase($numberToString(n, 16)), 4, '0', 'start'); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/ValidateAndApplyPropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/2021/ValidateAndApplyPropertyDescriptor.js new file mode 100644 index 00000000..a7fd218a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/ValidateAndApplyPropertyDescriptor.js @@ -0,0 +1,170 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var DefineOwnProperty = require('../helpers/DefineOwnProperty'); +var isPropertyDescriptor = require('../helpers/isPropertyDescriptor'); +var isSamePropertyDescriptor = require('../helpers/isSamePropertyDescriptor'); + +var FromPropertyDescriptor = require('./FromPropertyDescriptor'); +var IsAccessorDescriptor = require('./IsAccessorDescriptor'); +var IsDataDescriptor = require('./IsDataDescriptor'); +var IsGenericDescriptor = require('./IsGenericDescriptor'); +var IsPropertyKey = require('./IsPropertyKey'); +var SameValue = require('./SameValue'); +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-validateandapplypropertydescriptor +// https://ecma-international.org/ecma-262/8.0/#sec-validateandapplypropertydescriptor + +// eslint-disable-next-line max-lines-per-function, max-statements, max-params +module.exports = function ValidateAndApplyPropertyDescriptor(O, P, extensible, Desc, current) { + // this uses the ES2017+ logic, since it fixes a number of bugs in the ES2015 logic. + var oType = Type(O); + if (oType !== 'Undefined' && oType !== 'Object') { + throw new $TypeError('Assertion failed: O must be undefined or an Object'); + } + if (Type(extensible) !== 'Boolean') { + throw new $TypeError('Assertion failed: extensible must be a Boolean'); + } + if (!isPropertyDescriptor({ + Type: Type, + IsDataDescriptor: IsDataDescriptor, + IsAccessorDescriptor: IsAccessorDescriptor + }, Desc)) { + throw new $TypeError('Assertion failed: Desc must be a Property Descriptor'); + } + if (Type(current) !== 'Undefined' && !isPropertyDescriptor({ + Type: Type, + IsDataDescriptor: IsDataDescriptor, + IsAccessorDescriptor: IsAccessorDescriptor + }, current)) { + throw new $TypeError('Assertion failed: current must be a Property Descriptor, or undefined'); + } + if (oType !== 'Undefined' && !IsPropertyKey(P)) { + throw new $TypeError('Assertion failed: if O is not undefined, P must be a Property Key'); + } + if (Type(current) === 'Undefined') { + if (!extensible) { + return false; + } + if (IsGenericDescriptor(Desc) || IsDataDescriptor(Desc)) { + if (oType !== 'Undefined') { + DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + { + '[[Configurable]]': Desc['[[Configurable]]'], + '[[Enumerable]]': Desc['[[Enumerable]]'], + '[[Value]]': Desc['[[Value]]'], + '[[Writable]]': Desc['[[Writable]]'] + } + ); + } + } else { + if (!IsAccessorDescriptor(Desc)) { + throw new $TypeError('Assertion failed: Desc is not an accessor descriptor'); + } + if (oType !== 'Undefined') { + return DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + Desc + ); + } + } + return true; + } + if (IsGenericDescriptor(Desc) && !('[[Configurable]]' in Desc) && !('[[Enumerable]]' in Desc)) { + return true; + } + if (isSamePropertyDescriptor({ SameValue: SameValue }, Desc, current)) { + return true; // removed by ES2017, but should still be correct + } + // "if every field in Desc is absent, return true" can't really match the assertion that it's a Property Descriptor + if (!current['[[Configurable]]']) { + if (Desc['[[Configurable]]']) { + return false; + } + if ('[[Enumerable]]' in Desc && !Desc['[[Enumerable]]'] === !!current['[[Enumerable]]']) { + return false; + } + } + if (IsGenericDescriptor(Desc)) { + // no further validation is required. + } else if (IsDataDescriptor(current) !== IsDataDescriptor(Desc)) { + if (!current['[[Configurable]]']) { + return false; + } + if (IsDataDescriptor(current)) { + if (oType !== 'Undefined') { + DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + { + '[[Configurable]]': current['[[Configurable]]'], + '[[Enumerable]]': current['[[Enumerable]]'], + '[[Get]]': undefined + } + ); + } + } else if (oType !== 'Undefined') { + DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + { + '[[Configurable]]': current['[[Configurable]]'], + '[[Enumerable]]': current['[[Enumerable]]'], + '[[Value]]': undefined + } + ); + } + } else if (IsDataDescriptor(current) && IsDataDescriptor(Desc)) { + if (!current['[[Configurable]]'] && !current['[[Writable]]']) { + if ('[[Writable]]' in Desc && Desc['[[Writable]]']) { + return false; + } + if ('[[Value]]' in Desc && !SameValue(Desc['[[Value]]'], current['[[Value]]'])) { + return false; + } + return true; + } + } else if (IsAccessorDescriptor(current) && IsAccessorDescriptor(Desc)) { + if (!current['[[Configurable]]']) { + if ('[[Set]]' in Desc && !SameValue(Desc['[[Set]]'], current['[[Set]]'])) { + return false; + } + if ('[[Get]]' in Desc && !SameValue(Desc['[[Get]]'], current['[[Get]]'])) { + return false; + } + return true; + } + } else { + throw new $TypeError('Assertion failed: current and Desc are not both data, both accessors, or one accessor and one data.'); + } + if (oType !== 'Undefined') { + return DefineOwnProperty( + IsDataDescriptor, + SameValue, + FromPropertyDescriptor, + O, + P, + Desc + ); + } + return true; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/WeakRefDeref.js b/docs/snippets/node_modules/es-abstract/2021/WeakRefDeref.js new file mode 100644 index 00000000..66d2d172 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/WeakRefDeref.js @@ -0,0 +1,24 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $deref = callBound('WeakRef.prototype.deref', true); + +var isWeakRef = require('is-weakref'); + +var AddToKeptObjects = require('./AddToKeptObjects'); + +// https://ecma-international.org/ecma-262/12.0/#sec-weakrefderef + +module.exports = function WeakRefDeref(weakRef) { + if (!isWeakRef(weakRef)) { + throw new $TypeError('Assertion failed: `weakRef` must be a WeakRef'); + } + var target = $deref(weakRef); + if (target) { + AddToKeptObjects(target); + } + return target; +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/WeekDay.js b/docs/snippets/node_modules/es-abstract/2021/WeekDay.js new file mode 100644 index 00000000..17cf94ca --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/WeekDay.js @@ -0,0 +1,10 @@ +'use strict'; + +var Day = require('./Day'); +var modulo = require('./modulo'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.6 + +module.exports = function WeekDay(t) { + return modulo(Day(t) + 4, 7); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/YearFromTime.js b/docs/snippets/node_modules/es-abstract/2021/YearFromTime.js new file mode 100644 index 00000000..be06ecbc --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/YearFromTime.js @@ -0,0 +1,16 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $Date = GetIntrinsic('%Date%'); + +var callBound = require('call-bind/callBound'); + +var $getUTCFullYear = callBound('Date.prototype.getUTCFullYear'); + +// https://262.ecma-international.org/5.1/#sec-15.9.1.3 + +module.exports = function YearFromTime(t) { + // largest y such that this.TimeFromYear(y) <= t + return $getUTCFullYear(new $Date(t)); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/abs.js b/docs/snippets/node_modules/es-abstract/2021/abs.js new file mode 100644 index 00000000..8bc45434 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/abs.js @@ -0,0 +1,11 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $abs = GetIntrinsic('%Math.abs%'); + +// http://262.ecma-international.org/5.1/#sec-5.2 + +module.exports = function abs(x) { + return $abs(x); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/clamp.js b/docs/snippets/node_modules/es-abstract/2021/clamp.js new file mode 100644 index 00000000..8da13948 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/clamp.js @@ -0,0 +1,18 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var max = GetIntrinsic('%Math.max%'); +var min = GetIntrinsic('%Math.min%'); + +var Type = require('./Type'); + +// https://262.ecma-international.org/12.0/#clamping + +module.exports = function clamp(x, lower, upper) { + if (Type(x) !== 'Number' || Type(lower) !== 'Number' || Type(upper) !== 'Number' || !(lower <= upper)) { + throw new $TypeError('Assertion failed: all three arguments must be MVs, and `lower` must be `<= upper`'); + } + return min(max(lower, x), upper); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/floor.js b/docs/snippets/node_modules/es-abstract/2021/floor.js new file mode 100644 index 00000000..8439df06 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/floor.js @@ -0,0 +1,11 @@ +'use strict'; + +// var modulo = require('./modulo'); +var $floor = Math.floor; + +// http://262.ecma-international.org/5.1/#sec-5.2 + +module.exports = function floor(x) { + // return x - modulo(x, 1); + return $floor(x); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/modulo.js b/docs/snippets/node_modules/es-abstract/2021/modulo.js new file mode 100644 index 00000000..b94bb52b --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/modulo.js @@ -0,0 +1,9 @@ +'use strict'; + +var mod = require('../helpers/mod'); + +// https://262.ecma-international.org/5.1/#sec-5.2 + +module.exports = function modulo(x, y) { + return mod(x, y); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/msFromTime.js b/docs/snippets/node_modules/es-abstract/2021/msFromTime.js new file mode 100644 index 00000000..a6bae767 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/msFromTime.js @@ -0,0 +1,11 @@ +'use strict'; + +var modulo = require('./modulo'); + +var msPerSecond = require('../helpers/timeConstants').msPerSecond; + +// https://262.ecma-international.org/5.1/#sec-15.9.1.10 + +module.exports = function msFromTime(t) { + return modulo(t, msPerSecond); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/substring.js b/docs/snippets/node_modules/es-abstract/2021/substring.js new file mode 100644 index 00000000..a2c724ad --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/substring.js @@ -0,0 +1,20 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var IsIntegralNumber = require('./IsIntegralNumber'); +var Type = require('./Type'); + +var callBound = require('call-bind/callBound'); + +var $slice = callBound('String.prototype.slice'); + +// https://262.ecma-international.org/12.0/#substring +module.exports = function substring(S, inclusiveStart, exclusiveEnd) { + if (Type(S) !== 'String' || !IsIntegralNumber(inclusiveStart) || (arguments.length > 2 && !IsIntegralNumber(exclusiveEnd))) { + throw new $TypeError('`S` must be a String, and `inclusiveStart` and `exclusiveEnd` must be integers'); + } + return $slice(S, inclusiveStart, arguments.length > 2 ? exclusiveEnd : S.length); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/thisBigIntValue.js b/docs/snippets/node_modules/es-abstract/2021/thisBigIntValue.js new file mode 100644 index 00000000..1fd12980 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/thisBigIntValue.js @@ -0,0 +1,22 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var callBound = require('call-bind/callBound'); + +var $TypeError = GetIntrinsic('%TypeError%'); +var $bigIntValueOf = callBound('BigInt.prototype.valueOf', true); + +var Type = require('./Type'); + +// https://262.ecma-international.org/11.0/#sec-thisbigintvalue + +module.exports = function thisBigIntValue(value) { + var type = Type(value); + if (type === 'BigInt') { + return value; + } + if (!$bigIntValueOf) { + throw new $TypeError('BigInt is not supported'); + } + return $bigIntValueOf(value); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/thisBooleanValue.js b/docs/snippets/node_modules/es-abstract/2021/thisBooleanValue.js new file mode 100644 index 00000000..27075b9c --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/thisBooleanValue.js @@ -0,0 +1,15 @@ +'use strict'; + +var $BooleanValueOf = require('call-bind/callBound')('Boolean.prototype.valueOf'); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-boolean-prototype-object + +module.exports = function thisBooleanValue(value) { + if (Type(value) === 'Boolean') { + return value; + } + + return $BooleanValueOf(value); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/thisNumberValue.js b/docs/snippets/node_modules/es-abstract/2021/thisNumberValue.js new file mode 100644 index 00000000..92968dcd --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/thisNumberValue.js @@ -0,0 +1,18 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); + +var Type = require('./Type'); + +var $NumberValueOf = callBound('Number.prototype.valueOf'); + +// https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-number-prototype-object + +module.exports = function thisNumberValue(value) { + if (Type(value) === 'Number') { + return value; + } + + return $NumberValueOf(value); +}; + diff --git a/docs/snippets/node_modules/es-abstract/2021/thisStringValue.js b/docs/snippets/node_modules/es-abstract/2021/thisStringValue.js new file mode 100644 index 00000000..8e4274d8 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/thisStringValue.js @@ -0,0 +1,15 @@ +'use strict'; + +var $StringValueOf = require('call-bind/callBound')('String.prototype.valueOf'); + +var Type = require('./Type'); + +// https://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-string-prototype-object + +module.exports = function thisStringValue(value) { + if (Type(value) === 'String') { + return value; + } + + return $StringValueOf(value); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/thisSymbolValue.js b/docs/snippets/node_modules/es-abstract/2021/thisSymbolValue.js new file mode 100644 index 00000000..91a55254 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/thisSymbolValue.js @@ -0,0 +1,19 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); + +var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true); + +var Type = require('./Type'); + +// https://262.ecma-international.org/9.0/#sec-thissymbolvalue + +module.exports = function thisSymbolValue(value) { + if (!$SymbolValueOf) { + throw new SyntaxError('Symbols are not supported; thisSymbolValue requires that `value` be a Symbol or a Symbol object'); + } + if (Type(value) === 'Symbol') { + return value; + } + return $SymbolValueOf(value); +}; diff --git a/docs/snippets/node_modules/es-abstract/2021/thisTimeValue.js b/docs/snippets/node_modules/es-abstract/2021/thisTimeValue.js new file mode 100644 index 00000000..a9a47ace --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/2021/thisTimeValue.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('../2018/thisTimeValue'); diff --git a/docs/snippets/node_modules/es-abstract/5/FromPropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/5/FromPropertyDescriptor.js index 506f65c3..ebf5c891 100644 --- a/docs/snippets/node_modules/es-abstract/5/FromPropertyDescriptor.js +++ b/docs/snippets/node_modules/es-abstract/5/FromPropertyDescriptor.js @@ -33,7 +33,7 @@ module.exports = function FromPropertyDescriptor(Desc) { enumerable: !!Desc['[[Enumerable]]'], configurable: !!Desc['[[Configurable]]'] }; - } else { - throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor'); } + throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor'); + }; diff --git a/docs/snippets/node_modules/es-abstract/CHANGELOG.md b/docs/snippets/node_modules/es-abstract/CHANGELOG.md index c409f841..c0bf8ef3 100644 --- a/docs/snippets/node_modules/es-abstract/CHANGELOG.md +++ b/docs/snippets/node_modules/es-abstract/CHANGELOG.md @@ -1,3 +1,51 @@ +1.19.1 / 2021-10-02 +================= + * [Fix] `ES2020+`: `CreateRegExpStringIterator`: should not have enumerable methods + * [Dev Deps] update `array.prototype.filter`, `array.prototype.indexof` + +1.19.0 / 2021-09-30 +================= + * [New] `ES2021+`: `IterableToList`: make `method` parameter optional (#61) + * [New] add ES2021 + * [New] `ES2020+`: add `StringToBigInt`, `ToBigInt`, `ToBigInt64`, `ToBigUint64` + * [New] `ES2017`+: add `IsSharedArrayBuffer`, `OrdinaryToPrimitive` + * [New] `ES2015+`: add `CharacterRange`, `IsCompatiblePropertyDescriptor` + * [New] `ES2020+`: add `CreateRegExpStringIterator` + * [Fix] `ES2020+`: `ToBigInt64`/`ToBigUint64`: avoid node v10.4-v10.8 bug with limited BigInt range + * [Fix] `ES2020+`: `AbstractRelationalComparison`, `AbstractEqualityComparison`: support BigInt + * [Fix] `ES2020+`: `ToBigInt64`/`ToBigUint64`: Improve the definitions of twoSixtyThree and twoSixtyFour (#140) + * [meta] do not publish .gitattributes + * [Tests] Correct the behavior of `safeBigInt` + * [Tests] Exclude dotfiles from the testing sweep (#141) + +1.18.7 / 2021-09-28 +================= + * [Fix] `getOwnPropertyDescriptor` helper: avoid crashing in IE < 9 + * [Fix] `ArraySetLength`: `node` `v0.6` has a bug where array lengths can be Set but not Defined + * [eslint] remove unused directive + * [Tests] fix spelling + +1.18.6 / 2021-09-07 +================= + * [Fix] `ES2020+`: `NumberToBigInt`: throw a SyntaxError when BigInts are not supported + * [Refactor] extract getSymbolDescription logic to `get-symbol-description` + * [Refactor] `ES2018+`: `AbstractRelationalComparison`: use `IsStringPrefix` + * [Deps] update `is-callable`, `is-regex`, `is-string` + * [Dev Deps] update `@ljharb/eslint-config`, `tape` + * [Tests] `GetSubstitution`: add cases + +1.18.5 / 2021-08-01 +================= + * [meta] remove "exports" (#133) + * [Dev Deps] update `eslint` + +1.18.4 / 2021-07-29 +================= + * [meta] partial revert of b54cfe8525faff482450e843a49d43be3a086225 + * [Deps] update `internal-slot`, `object-inspect` + * [Dev Deps] update `eslint`, `tape` + * [Tests] `ArraySetLength`: increase coverage + 1.18.3 / 2021-05-27 ================= * [Fix] `ES2020+`: `ToNumber`: ensure it throws on a BigInt (#130) diff --git a/docs/snippets/node_modules/es-abstract/es2015.js b/docs/snippets/node_modules/es-abstract/es2015.js index 79be9674..29a438ec 100644 --- a/docs/snippets/node_modules/es-abstract/es2015.js +++ b/docs/snippets/node_modules/es-abstract/es2015.js @@ -13,6 +13,7 @@ var ES6 = { ArraySpeciesCreate: require('./2015/ArraySpeciesCreate'), Call: require('./2015/Call'), CanonicalNumericIndexString: require('./2015/CanonicalNumericIndexString'), + CharacterRange: require('./2015/CharacterRange'), CompletePropertyDescriptor: require('./2015/CompletePropertyDescriptor'), CreateDataProperty: require('./2015/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2015/CreateDataPropertyOrThrow'), @@ -46,6 +47,7 @@ var ES6 = { IsAccessorDescriptor: require('./2015/IsAccessorDescriptor'), IsArray: require('./2015/IsArray'), IsCallable: require('./2015/IsCallable'), + IsCompatiblePropertyDescriptor: require('./2015/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2015/IsConcatSpreadable'), IsConstructor: require('./2015/IsConstructor'), IsDataDescriptor: require('./2015/IsDataDescriptor'), diff --git a/docs/snippets/node_modules/es-abstract/es2016.js b/docs/snippets/node_modules/es-abstract/es2016.js index 6fbdb0cf..fc20625c 100644 --- a/docs/snippets/node_modules/es-abstract/es2016.js +++ b/docs/snippets/node_modules/es-abstract/es2016.js @@ -13,6 +13,7 @@ var ES2016 = { ArraySpeciesCreate: require('./2016/ArraySpeciesCreate'), Call: require('./2016/Call'), CanonicalNumericIndexString: require('./2016/CanonicalNumericIndexString'), + CharacterRange: require('./2016/CharacterRange'), CompletePropertyDescriptor: require('./2016/CompletePropertyDescriptor'), CreateDataProperty: require('./2016/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2016/CreateDataPropertyOrThrow'), @@ -46,6 +47,7 @@ var ES2016 = { IsAccessorDescriptor: require('./2016/IsAccessorDescriptor'), IsArray: require('./2016/IsArray'), IsCallable: require('./2016/IsCallable'), + IsCompatiblePropertyDescriptor: require('./2016/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2016/IsConcatSpreadable'), IsConstructor: require('./2016/IsConstructor'), IsDataDescriptor: require('./2016/IsDataDescriptor'), diff --git a/docs/snippets/node_modules/es-abstract/es2017.js b/docs/snippets/node_modules/es-abstract/es2017.js index 3cf0c007..3583c7ad 100644 --- a/docs/snippets/node_modules/es-abstract/es2017.js +++ b/docs/snippets/node_modules/es-abstract/es2017.js @@ -13,6 +13,7 @@ var ES2017 = { ArraySpeciesCreate: require('./2017/ArraySpeciesCreate'), Call: require('./2017/Call'), CanonicalNumericIndexString: require('./2017/CanonicalNumericIndexString'), + CharacterRange: require('./2017/CharacterRange'), CompletePropertyDescriptor: require('./2017/CompletePropertyDescriptor'), CreateDataProperty: require('./2017/CreateDataProperty'), CreateDataPropertyOrThrow: require('./2017/CreateDataPropertyOrThrow'), @@ -46,6 +47,7 @@ var ES2017 = { IsAccessorDescriptor: require('./2017/IsAccessorDescriptor'), IsArray: require('./2017/IsArray'), IsCallable: require('./2017/IsCallable'), + IsCompatiblePropertyDescriptor: require('./2017/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2017/IsConcatSpreadable'), IsConstructor: require('./2017/IsConstructor'), IsDataDescriptor: require('./2017/IsDataDescriptor'), @@ -56,6 +58,7 @@ var ES2017 = { IsPropertyDescriptor: require('./2017/IsPropertyDescriptor'), IsPropertyKey: require('./2017/IsPropertyKey'), IsRegExp: require('./2017/IsRegExp'), + IsSharedArrayBuffer: require('./2017/IsSharedArrayBuffer'), IterableToList: require('./2017/IterableToList'), IteratorClose: require('./2017/IteratorClose'), IteratorComplete: require('./2017/IteratorComplete'), @@ -77,6 +80,7 @@ var ES2017 = { OrdinaryHasInstance: require('./2017/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2017/OrdinaryHasProperty'), OrdinarySetPrototypeOf: require('./2017/OrdinarySetPrototypeOf'), + OrdinaryToPrimitive: require('./2017/OrdinaryToPrimitive'), QuoteJSONString: require('./2017/QuoteJSONString'), RegExpCreate: require('./2017/RegExpCreate'), RegExpExec: require('./2017/RegExpExec'), diff --git a/docs/snippets/node_modules/es-abstract/es2018.js b/docs/snippets/node_modules/es-abstract/es2018.js index 2beb9890..294e3d4b 100644 --- a/docs/snippets/node_modules/es-abstract/es2018.js +++ b/docs/snippets/node_modules/es-abstract/es2018.js @@ -13,6 +13,7 @@ var ES2018 = { ArraySpeciesCreate: require('./2018/ArraySpeciesCreate'), Call: require('./2018/Call'), CanonicalNumericIndexString: require('./2018/CanonicalNumericIndexString'), + CharacterRange: require('./2018/CharacterRange'), CompletePropertyDescriptor: require('./2018/CompletePropertyDescriptor'), CopyDataProperties: require('./2018/CopyDataProperties'), CreateDataProperty: require('./2018/CreateDataProperty'), @@ -48,6 +49,7 @@ var ES2018 = { IsAccessorDescriptor: require('./2018/IsAccessorDescriptor'), IsArray: require('./2018/IsArray'), IsCallable: require('./2018/IsCallable'), + IsCompatiblePropertyDescriptor: require('./2018/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2018/IsConcatSpreadable'), IsConstructor: require('./2018/IsConstructor'), IsDataDescriptor: require('./2018/IsDataDescriptor'), @@ -57,6 +59,7 @@ var ES2018 = { IsPromise: require('./2018/IsPromise'), IsPropertyKey: require('./2018/IsPropertyKey'), IsRegExp: require('./2018/IsRegExp'), + IsSharedArrayBuffer: require('./2018/IsSharedArrayBuffer'), IsStringPrefix: require('./2018/IsStringPrefix'), IterableToList: require('./2018/IterableToList'), IteratorClose: require('./2018/IteratorClose'), @@ -80,6 +83,7 @@ var ES2018 = { OrdinaryHasInstance: require('./2018/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2018/OrdinaryHasProperty'), OrdinarySetPrototypeOf: require('./2018/OrdinarySetPrototypeOf'), + OrdinaryToPrimitive: require('./2018/OrdinaryToPrimitive'), PromiseResolve: require('./2018/PromiseResolve'), QuoteJSONString: require('./2018/QuoteJSONString'), RegExpCreate: require('./2018/RegExpCreate'), diff --git a/docs/snippets/node_modules/es-abstract/es2019.js b/docs/snippets/node_modules/es-abstract/es2019.js index a49e1152..016cb721 100644 --- a/docs/snippets/node_modules/es-abstract/es2019.js +++ b/docs/snippets/node_modules/es-abstract/es2019.js @@ -14,6 +14,7 @@ var ES2019 = { ArraySpeciesCreate: require('./2019/ArraySpeciesCreate'), Call: require('./2019/Call'), CanonicalNumericIndexString: require('./2019/CanonicalNumericIndexString'), + CharacterRange: require('./2019/CharacterRange'), CompletePropertyDescriptor: require('./2019/CompletePropertyDescriptor'), CopyDataProperties: require('./2019/CopyDataProperties'), CreateDataProperty: require('./2019/CreateDataProperty'), @@ -50,6 +51,7 @@ var ES2019 = { IsAccessorDescriptor: require('./2019/IsAccessorDescriptor'), IsArray: require('./2019/IsArray'), IsCallable: require('./2019/IsCallable'), + IsCompatiblePropertyDescriptor: require('./2019/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2019/IsConcatSpreadable'), IsConstructor: require('./2019/IsConstructor'), IsDataDescriptor: require('./2019/IsDataDescriptor'), @@ -59,6 +61,7 @@ var ES2019 = { IsPromise: require('./2019/IsPromise'), IsPropertyKey: require('./2019/IsPropertyKey'), IsRegExp: require('./2019/IsRegExp'), + IsSharedArrayBuffer: require('./2019/IsSharedArrayBuffer'), IsStringPrefix: require('./2019/IsStringPrefix'), IterableToList: require('./2019/IterableToList'), IteratorClose: require('./2019/IteratorClose'), @@ -82,6 +85,7 @@ var ES2019 = { OrdinaryHasInstance: require('./2019/OrdinaryHasInstance'), OrdinaryHasProperty: require('./2019/OrdinaryHasProperty'), OrdinarySetPrototypeOf: require('./2019/OrdinarySetPrototypeOf'), + OrdinaryToPrimitive: require('./2019/OrdinaryToPrimitive'), PromiseResolve: require('./2019/PromiseResolve'), QuoteJSONString: require('./2019/QuoteJSONString'), RegExpCreate: require('./2019/RegExpCreate'), diff --git a/docs/snippets/node_modules/es-abstract/es2020.js b/docs/snippets/node_modules/es-abstract/es2020.js index e6d1c794..eb4b187b 100644 --- a/docs/snippets/node_modules/es-abstract/es2020.js +++ b/docs/snippets/node_modules/es-abstract/es2020.js @@ -19,6 +19,7 @@ var ES2020 = { BinaryXor: require('./2020/BinaryXor'), Call: require('./2020/Call'), CanonicalNumericIndexString: require('./2020/CanonicalNumericIndexString'), + CharacterRange: require('./2020/CharacterRange'), CodePointAt: require('./2020/CodePointAt'), CompletePropertyDescriptor: require('./2020/CompletePropertyDescriptor'), CopyDataProperties: require('./2020/CopyDataProperties'), @@ -28,6 +29,7 @@ var ES2020 = { CreateIterResultObject: require('./2020/CreateIterResultObject'), CreateListFromArrayLike: require('./2020/CreateListFromArrayLike'), CreateMethodProperty: require('./2020/CreateMethodProperty'), + CreateRegExpStringIterator: require('./2020/CreateRegExpStringIterator'), DateFromTime: require('./2020/DateFromTime'), DateString: require('./2020/DateString'), Day: require('./2020/Day'), @@ -57,6 +59,7 @@ var ES2020 = { IsArray: require('./2020/IsArray'), IsBigIntElementType: require('./2020/IsBigIntElementType'), IsCallable: require('./2020/IsCallable'), + IsCompatiblePropertyDescriptor: require('./2020/IsCompatiblePropertyDescriptor'), IsConcatSpreadable: require('./2020/IsConcatSpreadable'), IsConstructor: require('./2020/IsConstructor'), IsDataDescriptor: require('./2020/IsDataDescriptor'), @@ -68,6 +71,7 @@ var ES2020 = { IsPromise: require('./2020/IsPromise'), IsPropertyKey: require('./2020/IsPropertyKey'), IsRegExp: require('./2020/IsRegExp'), + IsSharedArrayBuffer: require('./2020/IsSharedArrayBuffer'), IsStringPrefix: require('./2020/IsStringPrefix'), IsUnclampedIntegerElementType: require('./2020/IsUnclampedIntegerElementType'), IsUnsignedElementType: require('./2020/IsUnsignedElementType'), @@ -96,6 +100,7 @@ var ES2020 = { OrdinaryHasProperty: require('./2020/OrdinaryHasProperty'), OrdinaryObjectCreate: require('./2020/OrdinaryObjectCreate'), OrdinarySetPrototypeOf: require('./2020/OrdinarySetPrototypeOf'), + OrdinaryToPrimitive: require('./2020/OrdinaryToPrimitive'), PromiseResolve: require('./2020/PromiseResolve'), QuoteJSONString: require('./2020/QuoteJSONString'), RegExpCreate: require('./2020/RegExpCreate'), @@ -114,6 +119,7 @@ var ES2020 = { StringCreate: require('./2020/StringCreate'), StringGetOwnProperty: require('./2020/StringGetOwnProperty'), StringPad: require('./2020/StringPad'), + StringToBigInt: require('./2020/StringToBigInt'), SymbolDescriptiveString: require('./2020/SymbolDescriptiveString'), TestIntegrityLevel: require('./2020/TestIntegrityLevel'), thisBigIntValue: require('./2020/thisBigIntValue'), @@ -126,6 +132,9 @@ var ES2020 = { TimeFromYear: require('./2020/TimeFromYear'), TimeString: require('./2020/TimeString'), TimeWithinDay: require('./2020/TimeWithinDay'), + ToBigInt: require('./2020/ToBigInt'), + ToBigInt64: require('./2020/ToBigInt64'), + ToBigUint64: require('./2020/ToBigUint64'), ToBoolean: require('./2020/ToBoolean'), ToDateString: require('./2020/ToDateString'), ToIndex: require('./2020/ToIndex'), diff --git a/docs/snippets/node_modules/es-abstract/es2021.js b/docs/snippets/node_modules/es-abstract/es2021.js new file mode 100644 index 00000000..f1a2ae88 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/es2021.js @@ -0,0 +1,178 @@ +'use strict'; + +/* eslint global-require: 0 */ +// https://www.ecma-international.org/ecma-262/12.0/#sec-abstract-operations +var ES2021 = { + 'Abstract Equality Comparison': require('./2021/AbstractEqualityComparison'), + 'Abstract Relational Comparison': require('./2021/AbstractRelationalComparison'), + 'Strict Equality Comparison': require('./2021/StrictEqualityComparison'), + abs: require('./2021/abs'), + AddEntriesFromIterable: require('./2021/AddEntriesFromIterable'), + AddToKeptObjects: require('./2021/AddToKeptObjects'), + AdvanceStringIndex: require('./2021/AdvanceStringIndex'), + ApplyStringOrNumericBinaryOperator: require('./2021/ApplyStringOrNumericBinaryOperator'), + ArrayCreate: require('./2021/ArrayCreate'), + ArraySetLength: require('./2021/ArraySetLength'), + ArraySpeciesCreate: require('./2021/ArraySpeciesCreate'), + BigInt: require('./2021/BigInt'), + BigIntBitwiseOp: require('./2021/BigIntBitwiseOp'), + BinaryAnd: require('./2021/BinaryAnd'), + BinaryOr: require('./2021/BinaryOr'), + BinaryXor: require('./2021/BinaryXor'), + ByteListBitwiseOp: require('./2021/ByteListBitwiseOp'), + ByteListEqual: require('./2021/ByteListEqual'), + Call: require('./2021/Call'), + CanonicalNumericIndexString: require('./2021/CanonicalNumericIndexString'), + CharacterRange: require('./2021/CharacterRange'), + clamp: require('./2021/clamp'), + substring: require('./2021/substring'), + ClearKeptObjects: require('./2021/ClearKeptObjects'), + CodePointAt: require('./2021/CodePointAt'), + CodePointsToString: require('./2021/CodePointsToString'), + CompletePropertyDescriptor: require('./2021/CompletePropertyDescriptor'), + CopyDataProperties: require('./2021/CopyDataProperties'), + CreateDataProperty: require('./2021/CreateDataProperty'), + CreateDataPropertyOrThrow: require('./2021/CreateDataPropertyOrThrow'), + CreateHTML: require('./2021/CreateHTML'), + CreateIterResultObject: require('./2021/CreateIterResultObject'), + CreateListFromArrayLike: require('./2021/CreateListFromArrayLike'), + CreateMethodProperty: require('./2021/CreateMethodProperty'), + CreateRegExpStringIterator: require('./2021/CreateRegExpStringIterator'), + DateFromTime: require('./2021/DateFromTime'), + DateString: require('./2021/DateString'), + Day: require('./2021/Day'), + DayFromYear: require('./2021/DayFromYear'), + DaysInYear: require('./2021/DaysInYear'), + DayWithinYear: require('./2021/DayWithinYear'), + DefinePropertyOrThrow: require('./2021/DefinePropertyOrThrow'), + DeletePropertyOrThrow: require('./2021/DeletePropertyOrThrow'), + EnumerableOwnPropertyNames: require('./2021/EnumerableOwnPropertyNames'), + FlattenIntoArray: require('./2021/FlattenIntoArray'), + floor: require('./2021/floor'), + FromPropertyDescriptor: require('./2021/FromPropertyDescriptor'), + Get: require('./2021/Get'), + GetIterator: require('./2021/GetIterator'), + GetMethod: require('./2021/GetMethod'), + GetOwnPropertyKeys: require('./2021/GetOwnPropertyKeys'), + GetPromiseResolve: require('./2021/GetPromiseResolve'), + GetPrototypeFromConstructor: require('./2021/GetPrototypeFromConstructor'), + GetSubstitution: require('./2021/GetSubstitution'), + GetV: require('./2021/GetV'), + HasOwnProperty: require('./2021/HasOwnProperty'), + HasProperty: require('./2021/HasProperty'), + HourFromTime: require('./2021/HourFromTime'), + InLeapYear: require('./2021/InLeapYear'), + InstanceofOperator: require('./2021/InstanceofOperator'), + Invoke: require('./2021/Invoke'), + IsAccessorDescriptor: require('./2021/IsAccessorDescriptor'), + IsArray: require('./2021/IsArray'), + IsBigIntElementType: require('./2021/IsBigIntElementType'), + IsCallable: require('./2021/IsCallable'), + IsCompatiblePropertyDescriptor: require('./2021/IsCompatiblePropertyDescriptor'), + IsConcatSpreadable: require('./2021/IsConcatSpreadable'), + IsConstructor: require('./2021/IsConstructor'), + IsDataDescriptor: require('./2021/IsDataDescriptor'), + IsExtensible: require('./2021/IsExtensible'), + IsGenericDescriptor: require('./2021/IsGenericDescriptor'), + IsIntegralNumber: require('./2021/IsIntegralNumber'), + IsNoTearConfiguration: require('./2021/IsNoTearConfiguration'), + IsPromise: require('./2021/IsPromise'), + IsPropertyKey: require('./2021/IsPropertyKey'), + IsRegExp: require('./2021/IsRegExp'), + IsSharedArrayBuffer: require('./2021/IsSharedArrayBuffer'), + IsStringPrefix: require('./2021/IsStringPrefix'), + IsUnclampedIntegerElementType: require('./2021/IsUnclampedIntegerElementType'), + IsUnsignedElementType: require('./2021/IsUnsignedElementType'), + IterableToList: require('./2021/IterableToList'), + IteratorClose: require('./2021/IteratorClose'), + IteratorComplete: require('./2021/IteratorComplete'), + IteratorNext: require('./2021/IteratorNext'), + IteratorStep: require('./2021/IteratorStep'), + IteratorValue: require('./2021/IteratorValue'), + LengthOfArrayLike: require('./2021/LengthOfArrayLike'), + MakeDate: require('./2021/MakeDate'), + MakeDay: require('./2021/MakeDay'), + MakeTime: require('./2021/MakeTime'), + MinFromTime: require('./2021/MinFromTime'), + modulo: require('./2021/modulo'), + MonthFromTime: require('./2021/MonthFromTime'), + msFromTime: require('./2021/msFromTime'), + Number: require('./2021/Number'), + NumberBitwiseOp: require('./2021/NumberBitwiseOp'), + NumberToBigInt: require('./2021/NumberToBigInt'), + OrdinaryCreateFromConstructor: require('./2021/OrdinaryCreateFromConstructor'), + OrdinaryDefineOwnProperty: require('./2021/OrdinaryDefineOwnProperty'), + OrdinaryGetOwnProperty: require('./2021/OrdinaryGetOwnProperty'), + OrdinaryGetPrototypeOf: require('./2021/OrdinaryGetPrototypeOf'), + OrdinaryHasInstance: require('./2021/OrdinaryHasInstance'), + OrdinaryHasProperty: require('./2021/OrdinaryHasProperty'), + OrdinaryObjectCreate: require('./2021/OrdinaryObjectCreate'), + OrdinarySetPrototypeOf: require('./2021/OrdinarySetPrototypeOf'), + OrdinaryToPrimitive: require('./2021/OrdinaryToPrimitive'), + PromiseResolve: require('./2021/PromiseResolve'), + QuoteJSONString: require('./2021/QuoteJSONString'), + RegExpCreate: require('./2021/RegExpCreate'), + RegExpExec: require('./2021/RegExpExec'), + RequireObjectCoercible: require('./2021/RequireObjectCoercible'), + SameValue: require('./2021/SameValue'), + SameValueNonNumeric: require('./2021/SameValueNonNumeric'), + SameValueZero: require('./2021/SameValueZero'), + SecFromTime: require('./2021/SecFromTime'), + Set: require('./2021/Set'), + SetFunctionLength: require('./2021/SetFunctionLength'), + SetFunctionName: require('./2021/SetFunctionName'), + SetIntegrityLevel: require('./2021/SetIntegrityLevel'), + SpeciesConstructor: require('./2021/SpeciesConstructor'), + SplitMatch: require('./2021/SplitMatch'), + StringCreate: require('./2021/StringCreate'), + StringGetOwnProperty: require('./2021/StringGetOwnProperty'), + StringIndexOf: require('./2021/StringIndexOf'), + StringPad: require('./2021/StringPad'), + StringToBigInt: require('./2021/StringToBigInt'), + StringToCodePoints: require('./2021/StringToCodePoints'), + SymbolDescriptiveString: require('./2021/SymbolDescriptiveString'), + TestIntegrityLevel: require('./2021/TestIntegrityLevel'), + thisBigIntValue: require('./2021/thisBigIntValue'), + thisBooleanValue: require('./2021/thisBooleanValue'), + thisNumberValue: require('./2021/thisNumberValue'), + thisStringValue: require('./2021/thisStringValue'), + thisSymbolValue: require('./2021/thisSymbolValue'), + thisTimeValue: require('./2021/thisTimeValue'), + TimeClip: require('./2021/TimeClip'), + TimeFromYear: require('./2021/TimeFromYear'), + TimeString: require('./2021/TimeString'), + TimeWithinDay: require('./2021/TimeWithinDay'), + ToBigInt: require('./2021/ToBigInt'), + ToBigInt64: require('./2021/ToBigInt64'), + ToBigUint64: require('./2021/ToBigUint64'), + ToBoolean: require('./2021/ToBoolean'), + ToDateString: require('./2021/ToDateString'), + ToIndex: require('./2021/ToIndex'), + ToInt16: require('./2021/ToInt16'), + ToInt32: require('./2021/ToInt32'), + ToInt8: require('./2021/ToInt8'), + ToIntegerOrInfinity: require('./2021/ToIntegerOrInfinity'), + ToLength: require('./2021/ToLength'), + ToNumber: require('./2021/ToNumber'), + ToNumeric: require('./2021/ToNumeric'), + ToObject: require('./2021/ToObject'), + ToPrimitive: require('./2021/ToPrimitive'), + ToPropertyDescriptor: require('./2021/ToPropertyDescriptor'), + ToPropertyKey: require('./2021/ToPropertyKey'), + ToString: require('./2021/ToString'), + ToUint16: require('./2021/ToUint16'), + ToUint32: require('./2021/ToUint32'), + ToUint8: require('./2021/ToUint8'), + ToUint8Clamp: require('./2021/ToUint8Clamp'), + TrimString: require('./2021/TrimString'), + Type: require('./2021/Type'), + UnicodeEscape: require('./2021/UnicodeEscape'), + UTF16EncodeCodePoint: require('./2021/UTF16EncodeCodePoint'), + UTF16SurrogatePairToCodePoint: require('./2021/UTF16SurrogatePairToCodePoint'), + ValidateAndApplyPropertyDescriptor: require('./2021/ValidateAndApplyPropertyDescriptor'), + WeakRefDeref: require('./2021/WeakRefDeref'), + WeekDay: require('./2021/WeekDay'), + YearFromTime: require('./2021/YearFromTime') +}; + +module.exports = ES2021; diff --git a/docs/snippets/node_modules/es-abstract/helpers/DefineOwnProperty.js b/docs/snippets/node_modules/es-abstract/helpers/DefineOwnProperty.js index 1a378a41..fb870f74 100644 --- a/docs/snippets/node_modules/es-abstract/helpers/DefineOwnProperty.js +++ b/docs/snippets/node_modules/es-abstract/helpers/DefineOwnProperty.js @@ -13,6 +13,12 @@ if ($defineProperty) { } } +// node v0.6 has a bug where array lengths can be Set but not Defined +var hasArrayLengthDefineBug = Object.defineProperty && Object.defineProperty([], 'length', { value: 1 }).length === 0; + +// eslint-disable-next-line global-require +var isArray = hasArrayLengthDefineBug && require('../2020/IsArray'); // this does not depend on any other AOs. + var callBound = require('call-bind/callBound'); var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); @@ -40,6 +46,18 @@ module.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPro O[P] = V; // will use [[Define]] return SameValue(O[P], V); } + if ( + hasArrayLengthDefineBug + && P === 'length' + && '[[Value]]' in desc + && isArray(O) + && O.length !== desc['[[Value]]'] + ) { + // eslint-disable-next-line no-param-reassign + O.length = desc['[[Value]]']; + return O.length === desc['[[Value]]']; + } + $defineProperty(O, P, FromPropertyDescriptor(desc)); return true; }; diff --git a/docs/snippets/node_modules/es-abstract/helpers/getInferredName.js b/docs/snippets/node_modules/es-abstract/helpers/getInferredName.js index 2dab6e77..5fd24ffa 100644 --- a/docs/snippets/node_modules/es-abstract/helpers/getInferredName.js +++ b/docs/snippets/node_modules/es-abstract/helpers/getInferredName.js @@ -1,10 +1,4 @@ 'use strict'; -var getInferredName; -try { - // eslint-disable-next-line no-new-func - getInferredName = Function('s', 'return { [s]() {} }[s].name;'); -} catch (e) {} - -var inferred = function () {}; -module.exports = getInferredName && inferred.name === 'inferred' ? getInferredName : null; +// TODO: remove, semver-major +module.exports = require('get-symbol-description/getInferredName'); diff --git a/docs/snippets/node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js b/docs/snippets/node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js index 79cf0488..352fbc6b 100644 --- a/docs/snippets/node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js +++ b/docs/snippets/node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js @@ -2,7 +2,7 @@ var GetIntrinsic = require('get-intrinsic'); -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%'); +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); if ($gOPD) { try { $gOPD([], 'length'); diff --git a/docs/snippets/node_modules/es-abstract/helpers/getSymbolDescription.js b/docs/snippets/node_modules/es-abstract/helpers/getSymbolDescription.js index e31cad27..699705f4 100644 --- a/docs/snippets/node_modules/es-abstract/helpers/getSymbolDescription.js +++ b/docs/snippets/node_modules/es-abstract/helpers/getSymbolDescription.js @@ -1,41 +1,4 @@ 'use strict'; -var GetIntrinsic = require('get-intrinsic'); - -var callBound = require('call-bind/callBound'); - -var $SyntaxError = GetIntrinsic('%SyntaxError%'); -var getGlobalSymbolDescription = GetIntrinsic('%Symbol.keyFor%', true); -var thisSymbolValue = callBound('%Symbol.prototype.valueOf%', true); -var symToStr = callBound('Symbol.prototype.toString', true); - -var getInferredName = require('./getInferredName'); - -/* eslint-disable consistent-return */ -module.exports = callBound('%Symbol.prototype.description%', true) || function getSymbolDescription(symbol) { - if (!thisSymbolValue) { - throw new $SyntaxError('Symbols are not supported in this environment'); - } - - // will throw if not a symbol primitive or wrapper object - var sym = thisSymbolValue(symbol); - - if (getInferredName) { - var name = getInferredName(sym); - if (name === '') { return; } - return name.slice(1, -1); // name.slice('['.length, -']'.length); - } - - var desc; - if (getGlobalSymbolDescription) { - desc = getGlobalSymbolDescription(sym); - if (typeof desc === 'string') { - return desc; - } - } - - desc = symToStr(sym).slice(7, -1); // str.slice('Symbol('.length, -')'.length); - if (desc) { - return desc; - } -}; +// TODO: remove, semver-major +module.exports = require('get-symbol-description'); diff --git a/docs/snippets/node_modules/es-abstract/helpers/modBigInt.js b/docs/snippets/node_modules/es-abstract/helpers/modBigInt.js new file mode 100644 index 00000000..22be2a1a --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/helpers/modBigInt.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function bigIntMod(BigIntRemainder, bigint, modulo) { + var remain = BigIntRemainder(bigint, modulo); + return remain >= 0 ? remain : remain + modulo; +}; diff --git a/docs/snippets/node_modules/es-abstract/index.js b/docs/snippets/node_modules/es-abstract/index.js index 5cd52929..a95c9e6a 100644 --- a/docs/snippets/node_modules/es-abstract/index.js +++ b/docs/snippets/node_modules/es-abstract/index.js @@ -9,6 +9,7 @@ var ES2017 = require('./es2017'); var ES2018 = require('./es2018'); var ES2019 = require('./es2019'); var ES2020 = require('./es2020'); +var ES2021 = require('./es2021'); var ES = { ES5: ES5, @@ -19,7 +20,8 @@ var ES = { ES2017: ES2017, ES2018: ES2018, ES2019: ES2019, - ES2020: ES2020 + ES2020: ES2020, + ES2021: ES2021 }; assign(ES, ES5); delete ES.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible diff --git a/docs/snippets/node_modules/es-abstract/operations/2021.js b/docs/snippets/node_modules/es-abstract/operations/2021.js new file mode 100644 index 00000000..5b8fd718 --- /dev/null +++ b/docs/snippets/node_modules/es-abstract/operations/2021.js @@ -0,0 +1,439 @@ +'use strict'; + +module.exports = { + abs: 'https://262.ecma-international.org/12.0/#eqn-abs', + 'Abstract Equality Comparison': 'https://262.ecma-international.org/12.0/#sec-abstract-equality-comparison', + 'Abstract Relational Comparison': 'https://262.ecma-international.org/12.0/#sec-abstract-relational-comparison', + AddEntriesFromIterable: 'https://262.ecma-international.org/12.0/#sec-add-entries-from-iterable', + AddRestrictedFunctionProperties: 'https://262.ecma-international.org/12.0/#sec-addrestrictedfunctionproperties', + AddToKeptObjects: 'https://262.ecma-international.org/12.0/#sec-addtokeptobjects', + AddWaiter: 'https://262.ecma-international.org/12.0/#sec-addwaiter', + AdvanceStringIndex: 'https://262.ecma-international.org/12.0/#sec-advancestringindex', + 'agent-order': 'https://262.ecma-international.org/12.0/#sec-agent-order', + AgentCanSuspend: 'https://262.ecma-international.org/12.0/#sec-agentcansuspend', + AgentSignifier: 'https://262.ecma-international.org/12.0/#sec-agentsignifier', + AllocateArrayBuffer: 'https://262.ecma-international.org/12.0/#sec-allocatearraybuffer', + AllocateSharedArrayBuffer: 'https://262.ecma-international.org/12.0/#sec-allocatesharedarraybuffer', + AllocateTypedArray: 'https://262.ecma-international.org/12.0/#sec-allocatetypedarray', + AllocateTypedArrayBuffer: 'https://262.ecma-international.org/12.0/#sec-allocatetypedarraybuffer', + ApplyStringOrNumericBinaryOperator: 'https://262.ecma-international.org/12.0/#sec-applystringornumericbinaryoperator', + ArrayCreate: 'https://262.ecma-international.org/12.0/#sec-arraycreate', + ArraySetLength: 'https://262.ecma-international.org/12.0/#sec-arraysetlength', + ArraySpeciesCreate: 'https://262.ecma-international.org/12.0/#sec-arrayspeciescreate', + AsyncFromSyncIteratorContinuation: 'https://262.ecma-international.org/12.0/#sec-asyncfromsynciteratorcontinuation', + AsyncFunctionStart: 'https://262.ecma-international.org/12.0/#sec-async-functions-abstract-operations-async-function-start', + AsyncGeneratorEnqueue: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorenqueue', + AsyncGeneratorReject: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorreject', + AsyncGeneratorResolve: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorresolve', + AsyncGeneratorResumeNext: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorresumenext', + AsyncGeneratorStart: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorstart', + AsyncGeneratorValidate: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratorvalidate', + AsyncGeneratorYield: 'https://262.ecma-international.org/12.0/#sec-asyncgeneratoryield', + AsyncIteratorClose: 'https://262.ecma-international.org/12.0/#sec-asynciteratorclose', + AtomicReadModifyWrite: 'https://262.ecma-international.org/12.0/#sec-atomicreadmodifywrite', + Await: 'https://262.ecma-international.org/12.0/#await', + BackreferenceMatcher: 'https://262.ecma-international.org/12.0/#sec-backreference-matcher', + 'BigInt::add': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-add', + 'BigInt::bitwiseAND': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseAND', + 'BigInt::bitwiseNOT': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseNOT', + 'BigInt::bitwiseOR': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseOR', + 'BigInt::bitwiseXOR': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-bitwiseXOR', + 'BigInt::divide': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-divide', + 'BigInt::equal': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-equal', + 'BigInt::exponentiate': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-exponentiate', + 'BigInt::leftShift': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-leftShift', + 'BigInt::lessThan': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-lessThan', + 'BigInt::multiply': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-multiply', + 'BigInt::remainder': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-remainder', + 'BigInt::sameValue': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-sameValue', + 'BigInt::sameValueZero': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-sameValueZero', + 'BigInt::signedRightShift': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-signedRightShift', + 'BigInt::subtract': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-subtract', + 'BigInt::toString': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-tostring', + 'BigInt::unaryMinus': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-unaryMinus', + 'BigInt::unsignedRightShift': 'https://262.ecma-international.org/12.0/#sec-numeric-types-bigint-unsignedRightShift', + BigIntBitwiseOp: 'https://262.ecma-international.org/12.0/#sec-bigintbitwiseop', + BinaryAnd: 'https://262.ecma-international.org/12.0/#sec-binaryand', + BinaryOr: 'https://262.ecma-international.org/12.0/#sec-binaryor', + BinaryXor: 'https://262.ecma-international.org/12.0/#sec-binaryxor', + BlockDeclarationInstantiation: 'https://262.ecma-international.org/12.0/#sec-blockdeclarationinstantiation', + BoundFunctionCreate: 'https://262.ecma-international.org/12.0/#sec-boundfunctioncreate', + ByteListBitwiseOp: 'https://262.ecma-international.org/12.0/#sec-bytelistbitwiseop', + ByteListEqual: 'https://262.ecma-international.org/12.0/#sec-bytelistequal', + Call: 'https://262.ecma-international.org/12.0/#sec-call', + Canonicalize: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-canonicalize-ch', + CanonicalNumericIndexString: 'https://262.ecma-international.org/12.0/#sec-canonicalnumericindexstring', + CaseClauseIsSelected: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-caseclauseisselected', + CharacterRange: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-characterrange-abstract-operation', + CharacterRangeOrUnion: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-characterrangeorunion-abstract-operation', + CharacterSetMatcher: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-charactersetmatcher-abstract-operation', + clamp: 'https://262.ecma-international.org/12.0/#clamping', + CleanupFinalizationRegistry: 'https://262.ecma-international.org/12.0/#sec-cleanup-finalization-registry', + ClearKeptObjects: 'https://262.ecma-international.org/12.0/#sec-clear-kept-objects', + CloneArrayBuffer: 'https://262.ecma-international.org/12.0/#sec-clonearraybuffer', + CodePointAt: 'https://262.ecma-international.org/12.0/#sec-codepointat', + CodePointsToString: 'https://262.ecma-international.org/12.0/#sec-codepointstostring', + CompletePropertyDescriptor: 'https://262.ecma-international.org/12.0/#sec-completepropertydescriptor', + Completion: 'https://262.ecma-international.org/12.0/#sec-completion-record-specification-type', + ComposeWriteEventBytes: 'https://262.ecma-international.org/12.0/#sec-composewriteeventbytes', + Construct: 'https://262.ecma-international.org/12.0/#sec-construct', + CopyDataBlockBytes: 'https://262.ecma-international.org/12.0/#sec-copydatablockbytes', + CopyDataProperties: 'https://262.ecma-international.org/12.0/#sec-copydataproperties', + CreateArrayFromList: 'https://262.ecma-international.org/12.0/#sec-createarrayfromlist', + CreateArrayIterator: 'https://262.ecma-international.org/12.0/#sec-createarrayiterator', + CreateAsyncFromSyncIterator: 'https://262.ecma-international.org/12.0/#sec-createasyncfromsynciterator', + CreateAsyncIteratorFromClosure: 'https://262.ecma-international.org/12.0/#sec-createasynciteratorfromclosure', + CreateBuiltinFunction: 'https://262.ecma-international.org/12.0/#sec-createbuiltinfunction', + CreateByteDataBlock: 'https://262.ecma-international.org/12.0/#sec-createbytedatablock', + CreateDataProperty: 'https://262.ecma-international.org/12.0/#sec-createdataproperty', + CreateDataPropertyOrThrow: 'https://262.ecma-international.org/12.0/#sec-createdatapropertyorthrow', + CreateDynamicFunction: 'https://262.ecma-international.org/12.0/#sec-createdynamicfunction', + CreateForInIterator: 'https://262.ecma-international.org/12.0/#sec-createforiniterator', + CreateHTML: 'https://262.ecma-international.org/12.0/#sec-createhtml', + CreateIntrinsics: 'https://262.ecma-international.org/12.0/#sec-createintrinsics', + CreateIteratorFromClosure: 'https://262.ecma-international.org/12.0/#sec-createiteratorfromclosure', + CreateIterResultObject: 'https://262.ecma-international.org/12.0/#sec-createiterresultobject', + CreateListFromArrayLike: 'https://262.ecma-international.org/12.0/#sec-createlistfromarraylike', + CreateListIteratorRecord: 'https://262.ecma-international.org/12.0/#sec-createlistiteratorRecord', + CreateMapIterator: 'https://262.ecma-international.org/12.0/#sec-createmapiterator', + CreateMappedArgumentsObject: 'https://262.ecma-international.org/12.0/#sec-createmappedargumentsobject', + CreateMethodProperty: 'https://262.ecma-international.org/12.0/#sec-createmethodproperty', + CreatePerIterationEnvironment: 'https://262.ecma-international.org/12.0/#sec-createperiterationenvironment', + CreateRealm: 'https://262.ecma-international.org/12.0/#sec-createrealm', + CreateRegExpStringIterator: 'https://262.ecma-international.org/12.0/#sec-createregexpstringiterator', + CreateResolvingFunctions: 'https://262.ecma-international.org/12.0/#sec-createresolvingfunctions', + CreateSetIterator: 'https://262.ecma-international.org/12.0/#sec-createsetiterator', + CreateSharedByteDataBlock: 'https://262.ecma-international.org/12.0/#sec-createsharedbytedatablock', + CreateUnmappedArgumentsObject: 'https://262.ecma-international.org/12.0/#sec-createunmappedargumentsobject', + DateFromTime: 'https://262.ecma-international.org/12.0/#sec-date-number', + DateString: 'https://262.ecma-international.org/12.0/#sec-datestring', + Day: 'https://262.ecma-international.org/12.0/#eqn-Day', + DayFromYear: 'https://262.ecma-international.org/12.0/#eqn-DaysFromYear', + DaysInYear: 'https://262.ecma-international.org/12.0/#eqn-DaysInYear', + DayWithinYear: 'https://262.ecma-international.org/12.0/#eqn-DayWithinYear', + Decode: 'https://262.ecma-international.org/12.0/#sec-decode', + DefinePropertyOrThrow: 'https://262.ecma-international.org/12.0/#sec-definepropertyorthrow', + DeletePropertyOrThrow: 'https://262.ecma-international.org/12.0/#sec-deletepropertyorthrow', + DetachArrayBuffer: 'https://262.ecma-international.org/12.0/#sec-detacharraybuffer', + Encode: 'https://262.ecma-international.org/12.0/#sec-encode', + EnterCriticalSection: 'https://262.ecma-international.org/12.0/#sec-entercriticalsection', + EnumerableOwnPropertyNames: 'https://262.ecma-international.org/12.0/#sec-enumerableownpropertynames', + EnumerateObjectProperties: 'https://262.ecma-international.org/12.0/#sec-enumerate-object-properties', + EscapeRegExpPattern: 'https://262.ecma-international.org/12.0/#sec-escaperegexppattern', + EvalDeclarationInstantiation: 'https://262.ecma-international.org/12.0/#sec-evaldeclarationinstantiation', + EvaluateCall: 'https://262.ecma-international.org/12.0/#sec-evaluatecall', + EvaluateNew: 'https://262.ecma-international.org/12.0/#sec-evaluatenew', + EvaluatePropertyAccessWithExpressionKey: 'https://262.ecma-international.org/12.0/#sec-evaluate-property-access-with-expression-key', + EvaluatePropertyAccessWithIdentifierKey: 'https://262.ecma-international.org/12.0/#sec-evaluate-property-access-with-identifier-key', + EvaluateStringOrNumericBinaryExpression: 'https://262.ecma-international.org/12.0/#sec-evaluatestringornumericbinaryexpression', + EventSet: 'https://262.ecma-international.org/12.0/#sec-event-set', + ExecuteModule: 'https://262.ecma-international.org/12.0/#sec-source-text-module-record-execute-module', + FinishDynamicImport: 'https://262.ecma-international.org/12.0/#sec-finishdynamicimport', + FlattenIntoArray: 'https://262.ecma-international.org/12.0/#sec-flattenintoarray', + floor: 'https://262.ecma-international.org/12.0/#eqn-floor', + ForBodyEvaluation: 'https://262.ecma-international.org/12.0/#sec-forbodyevaluation', + 'ForIn/OfBodyEvaluation': 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset', + 'ForIn/OfHeadEvaluation': 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-forinofheadevaluation', + FromPropertyDescriptor: 'https://262.ecma-international.org/12.0/#sec-frompropertydescriptor', + FulfillPromise: 'https://262.ecma-international.org/12.0/#sec-fulfillpromise', + FunctionDeclarationInstantiation: 'https://262.ecma-international.org/12.0/#sec-functiondeclarationinstantiation', + GeneratorResume: 'https://262.ecma-international.org/12.0/#sec-generatorresume', + GeneratorResumeAbrupt: 'https://262.ecma-international.org/12.0/#sec-generatorresumeabrupt', + GeneratorStart: 'https://262.ecma-international.org/12.0/#sec-generatorstart', + GeneratorValidate: 'https://262.ecma-international.org/12.0/#sec-generatorvalidate', + GeneratorYield: 'https://262.ecma-international.org/12.0/#sec-generatoryield', + Get: 'https://262.ecma-international.org/12.0/#sec-get-o-p', + GetActiveScriptOrModule: 'https://262.ecma-international.org/12.0/#sec-getactivescriptormodule', + GetFunctionRealm: 'https://262.ecma-international.org/12.0/#sec-getfunctionrealm', + GetGeneratorKind: 'https://262.ecma-international.org/12.0/#sec-getgeneratorkind', + GetGlobalObject: 'https://262.ecma-international.org/12.0/#sec-getglobalobject', + GetIdentifierReference: 'https://262.ecma-international.org/12.0/#sec-getidentifierreference', + GetIterator: 'https://262.ecma-international.org/12.0/#sec-getiterator', + GetMethod: 'https://262.ecma-international.org/12.0/#sec-getmethod', + GetModifySetValueInBuffer: 'https://262.ecma-international.org/12.0/#sec-getmodifysetvalueinbuffer', + GetModuleNamespace: 'https://262.ecma-international.org/12.0/#sec-getmodulenamespace', + GetNewTarget: 'https://262.ecma-international.org/12.0/#sec-getnewtarget', + GetOwnPropertyKeys: 'https://262.ecma-international.org/12.0/#sec-getownpropertykeys', + GetPromiseResolve: 'https://262.ecma-international.org/12.0/#sec-getpromiseresolve', + GetPrototypeFromConstructor: 'https://262.ecma-international.org/12.0/#sec-getprototypefromconstructor', + GetSubstitution: 'https://262.ecma-international.org/12.0/#sec-getsubstitution', + GetSuperConstructor: 'https://262.ecma-international.org/12.0/#sec-getsuperconstructor', + GetTemplateObject: 'https://262.ecma-international.org/12.0/#sec-gettemplateobject', + GetThisEnvironment: 'https://262.ecma-international.org/12.0/#sec-getthisenvironment', + GetThisValue: 'https://262.ecma-international.org/12.0/#sec-getthisvalue', + GetV: 'https://262.ecma-international.org/12.0/#sec-getv', + GetValue: 'https://262.ecma-international.org/12.0/#sec-getvalue', + GetValueFromBuffer: 'https://262.ecma-international.org/12.0/#sec-getvaluefrombuffer', + GetViewValue: 'https://262.ecma-international.org/12.0/#sec-getviewvalue', + GetWaiterList: 'https://262.ecma-international.org/12.0/#sec-getwaiterlist', + GlobalDeclarationInstantiation: 'https://262.ecma-international.org/12.0/#sec-globaldeclarationinstantiation', + 'happens-before': 'https://262.ecma-international.org/12.0/#sec-happens-before', + HasOwnProperty: 'https://262.ecma-international.org/12.0/#sec-hasownproperty', + HasProperty: 'https://262.ecma-international.org/12.0/#sec-hasproperty', + 'host-synchronizes-with': 'https://262.ecma-international.org/12.0/#sec-host-synchronizes-with', + HostCallJobCallback: 'https://262.ecma-international.org/12.0/#sec-hostcalljobcallback', + HostEnqueueFinalizationRegistryCleanupJob: 'https://262.ecma-international.org/12.0/#sec-host-cleanup-finalization-registry', + HostEnqueuePromiseJob: 'https://262.ecma-international.org/12.0/#sec-hostenqueuepromisejob', + HostEnsureCanCompileStrings: 'https://262.ecma-international.org/12.0/#sec-hostensurecancompilestrings', + HostEventSet: 'https://262.ecma-international.org/12.0/#sec-hosteventset', + HostFinalizeImportMeta: 'https://262.ecma-international.org/12.0/#sec-hostfinalizeimportmeta', + HostGetImportMetaProperties: 'https://262.ecma-international.org/12.0/#sec-hostgetimportmetaproperties', + HostHasSourceTextAvailable: 'https://262.ecma-international.org/12.0/#sec-hosthassourcetextavailable', + HostImportModuleDynamically: 'https://262.ecma-international.org/12.0/#sec-hostimportmoduledynamically', + HostMakeJobCallback: 'https://262.ecma-international.org/12.0/#sec-hostmakejobcallback', + HostPromiseRejectionTracker: 'https://262.ecma-international.org/12.0/#sec-host-promise-rejection-tracker', + HostResolveImportedModule: 'https://262.ecma-international.org/12.0/#sec-hostresolveimportedmodule', + HourFromTime: 'https://262.ecma-international.org/12.0/#eqn-HourFromTime', + IfAbruptRejectPromise: 'https://262.ecma-international.org/12.0/#sec-ifabruptrejectpromise', + ImportedLocalNames: 'https://262.ecma-international.org/12.0/#sec-importedlocalnames', + InitializeBoundName: 'https://262.ecma-international.org/12.0/#sec-initializeboundname', + InitializeEnvironment: 'https://262.ecma-international.org/12.0/#sec-source-text-module-record-initialize-environment', + InitializeHostDefinedRealm: 'https://262.ecma-international.org/12.0/#sec-initializehostdefinedrealm', + InitializeReferencedBinding: 'https://262.ecma-international.org/12.0/#sec-initializereferencedbinding', + InitializeTypedArrayFromArrayBuffer: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromarraybuffer', + InitializeTypedArrayFromArrayLike: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromarraylike', + InitializeTypedArrayFromList: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromlist', + InitializeTypedArrayFromTypedArray: 'https://262.ecma-international.org/12.0/#sec-initializetypedarrayfromtypedarray', + InLeapYear: 'https://262.ecma-international.org/12.0/#eqn-InLeapYear', + InnerModuleEvaluation: 'https://262.ecma-international.org/12.0/#sec-innermoduleevaluation', + InnerModuleLinking: 'https://262.ecma-international.org/12.0/#sec-InnerModuleLinking', + InstanceofOperator: 'https://262.ecma-international.org/12.0/#sec-instanceofoperator', + IntegerIndexedElementGet: 'https://262.ecma-international.org/12.0/#sec-integerindexedelementget', + IntegerIndexedElementSet: 'https://262.ecma-international.org/12.0/#sec-integerindexedelementset', + IntegerIndexedObjectCreate: 'https://262.ecma-international.org/12.0/#sec-integerindexedobjectcreate', + InternalizeJSONProperty: 'https://262.ecma-international.org/12.0/#sec-internalizejsonproperty', + Invoke: 'https://262.ecma-international.org/12.0/#sec-invoke', + IsAccessorDescriptor: 'https://262.ecma-international.org/12.0/#sec-isaccessordescriptor', + IsAnonymousFunctionDefinition: 'https://262.ecma-international.org/12.0/#sec-isanonymousfunctiondefinition', + IsArray: 'https://262.ecma-international.org/12.0/#sec-isarray', + IsBigIntElementType: 'https://262.ecma-international.org/12.0/#sec-isbigintelementtype', + IsCallable: 'https://262.ecma-international.org/12.0/#sec-iscallable', + IsCompatiblePropertyDescriptor: 'https://262.ecma-international.org/12.0/#sec-iscompatiblepropertydescriptor', + IsConcatSpreadable: 'https://262.ecma-international.org/12.0/#sec-isconcatspreadable', + IsConstructor: 'https://262.ecma-international.org/12.0/#sec-isconstructor', + IsDataDescriptor: 'https://262.ecma-international.org/12.0/#sec-isdatadescriptor', + IsDetachedBuffer: 'https://262.ecma-international.org/12.0/#sec-isdetachedbuffer', + IsExtensible: 'https://262.ecma-international.org/12.0/#sec-isextensible-o', + IsGenericDescriptor: 'https://262.ecma-international.org/12.0/#sec-isgenericdescriptor', + IsInTailPosition: 'https://262.ecma-international.org/12.0/#sec-isintailposition', + IsIntegralNumber: 'https://262.ecma-international.org/12.0/#sec-isintegralnumber', + IsLabelledFunction: 'https://262.ecma-international.org/12.0/#sec-islabelledfunction', + IsNoTearConfiguration: 'https://262.ecma-international.org/12.0/#sec-isnotearconfiguration', + IsPromise: 'https://262.ecma-international.org/12.0/#sec-ispromise', + IsPropertyKey: 'https://262.ecma-international.org/12.0/#sec-ispropertykey', + IsPropertyReference: 'https://262.ecma-international.org/12.0/#sec-ispropertyreference', + IsRegExp: 'https://262.ecma-international.org/12.0/#sec-isregexp', + IsSharedArrayBuffer: 'https://262.ecma-international.org/12.0/#sec-issharedarraybuffer', + IsStringPrefix: 'https://262.ecma-international.org/12.0/#sec-isstringprefix', + IsSuperReference: 'https://262.ecma-international.org/12.0/#sec-issuperreference', + IsUnclampedIntegerElementType: 'https://262.ecma-international.org/12.0/#sec-isunclampedintegerelementtype', + IsUnresolvableReference: 'https://262.ecma-international.org/12.0/#sec-isunresolvablereference', + IsUnsignedElementType: 'https://262.ecma-international.org/12.0/#sec-isunsignedelementtype', + IsValidIntegerIndex: 'https://262.ecma-international.org/12.0/#sec-isvalidintegerindex', + IsValidRegularExpressionLiteral: 'https://262.ecma-international.org/12.0/#sec-isvalidregularexpressionliteral', + IsWordChar: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-iswordchar-abstract-operation', + IterableToList: 'https://262.ecma-international.org/12.0/#sec-iterabletolist', + IteratorClose: 'https://262.ecma-international.org/12.0/#sec-iteratorclose', + IteratorComplete: 'https://262.ecma-international.org/12.0/#sec-iteratorcomplete', + IteratorNext: 'https://262.ecma-international.org/12.0/#sec-iteratornext', + IteratorStep: 'https://262.ecma-international.org/12.0/#sec-iteratorstep', + IteratorValue: 'https://262.ecma-international.org/12.0/#sec-iteratorvalue', + LeaveCriticalSection: 'https://262.ecma-international.org/12.0/#sec-leavecriticalsection', + LengthOfArrayLike: 'https://262.ecma-international.org/12.0/#sec-lengthofarraylike', + LocalTime: 'https://262.ecma-international.org/12.0/#sec-localtime', + LocalTZA: 'https://262.ecma-international.org/12.0/#sec-local-time-zone-adjustment', + LoopContinues: 'https://262.ecma-international.org/12.0/#sec-loopcontinues', + MakeArgGetter: 'https://262.ecma-international.org/12.0/#sec-makearggetter', + MakeArgSetter: 'https://262.ecma-international.org/12.0/#sec-makeargsetter', + MakeBasicObject: 'https://262.ecma-international.org/12.0/#sec-makebasicobject', + MakeClassConstructor: 'https://262.ecma-international.org/12.0/#sec-makeclassconstructor', + MakeConstructor: 'https://262.ecma-international.org/12.0/#sec-makeconstructor', + MakeDate: 'https://262.ecma-international.org/12.0/#sec-makedate', + MakeDay: 'https://262.ecma-international.org/12.0/#sec-makeday', + MakeMethod: 'https://262.ecma-international.org/12.0/#sec-makemethod', + MakeSuperPropertyReference: 'https://262.ecma-international.org/12.0/#sec-makesuperpropertyreference', + MakeTime: 'https://262.ecma-international.org/12.0/#sec-maketime', + max: 'https://262.ecma-international.org/12.0/#eqn-max', + 'memory-order': 'https://262.ecma-international.org/12.0/#sec-memory-order', + min: 'https://262.ecma-international.org/12.0/#eqn-min', + MinFromTime: 'https://262.ecma-international.org/12.0/#eqn-MinFromTime', + ModuleNamespaceCreate: 'https://262.ecma-international.org/12.0/#sec-modulenamespacecreate', + modulo: 'https://262.ecma-international.org/12.0/#eqn-modulo', + MonthFromTime: 'https://262.ecma-international.org/12.0/#eqn-MonthFromTime', + msFromTime: 'https://262.ecma-international.org/12.0/#eqn-msFromTime', + NewDeclarativeEnvironment: 'https://262.ecma-international.org/12.0/#sec-newdeclarativeenvironment', + NewFunctionEnvironment: 'https://262.ecma-international.org/12.0/#sec-newfunctionenvironment', + NewGlobalEnvironment: 'https://262.ecma-international.org/12.0/#sec-newglobalenvironment', + NewModuleEnvironment: 'https://262.ecma-international.org/12.0/#sec-newmoduleenvironment', + NewObjectEnvironment: 'https://262.ecma-international.org/12.0/#sec-newobjectenvironment', + NewPromiseCapability: 'https://262.ecma-international.org/12.0/#sec-newpromisecapability', + NewPromiseReactionJob: 'https://262.ecma-international.org/12.0/#sec-newpromisereactionjob', + NewPromiseResolveThenableJob: 'https://262.ecma-international.org/12.0/#sec-newpromiseresolvethenablejob', + NormalCompletion: 'https://262.ecma-international.org/12.0/#sec-normalcompletion', + NotifyWaiter: 'https://262.ecma-international.org/12.0/#sec-notifywaiter', + 'Number::add': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-add', + 'Number::bitwiseAND': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseAND', + 'Number::bitwiseNOT': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseNOT', + 'Number::bitwiseOR': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseOR', + 'Number::bitwiseXOR': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-bitwiseXOR', + 'Number::divide': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-divide', + 'Number::equal': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-equal', + 'Number::exponentiate': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-exponentiate', + 'Number::leftShift': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-leftShift', + 'Number::lessThan': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-lessThan', + 'Number::multiply': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-multiply', + 'Number::remainder': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-remainder', + 'Number::sameValue': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-sameValue', + 'Number::sameValueZero': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-sameValueZero', + 'Number::signedRightShift': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-signedRightShift', + 'Number::subtract': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-subtract', + 'Number::toString': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-tostring', + 'Number::unaryMinus': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-unaryMinus', + 'Number::unsignedRightShift': 'https://262.ecma-international.org/12.0/#sec-numeric-types-number-unsignedRightShift', + NumberBitwiseOp: 'https://262.ecma-international.org/12.0/#sec-numberbitwiseop', + NumberToBigInt: 'https://262.ecma-international.org/12.0/#sec-numbertobigint', + NumericToRawBytes: 'https://262.ecma-international.org/12.0/#sec-numerictorawbytes', + ObjectDefineProperties: 'https://262.ecma-international.org/12.0/#sec-objectdefineproperties', + OrdinaryCallBindThis: 'https://262.ecma-international.org/12.0/#sec-ordinarycallbindthis', + OrdinaryCallEvaluateBody: 'https://262.ecma-international.org/12.0/#sec-ordinarycallevaluatebody', + OrdinaryCreateFromConstructor: 'https://262.ecma-international.org/12.0/#sec-ordinarycreatefromconstructor', + OrdinaryDefineOwnProperty: 'https://262.ecma-international.org/12.0/#sec-ordinarydefineownproperty', + OrdinaryDelete: 'https://262.ecma-international.org/12.0/#sec-ordinarydelete', + OrdinaryFunctionCreate: 'https://262.ecma-international.org/12.0/#sec-ordinaryfunctioncreate', + OrdinaryGet: 'https://262.ecma-international.org/12.0/#sec-ordinaryget', + OrdinaryGetOwnProperty: 'https://262.ecma-international.org/12.0/#sec-ordinarygetownproperty', + OrdinaryGetPrototypeOf: 'https://262.ecma-international.org/12.0/#sec-ordinarygetprototypeof', + OrdinaryHasInstance: 'https://262.ecma-international.org/12.0/#sec-ordinaryhasinstance', + OrdinaryHasProperty: 'https://262.ecma-international.org/12.0/#sec-ordinaryhasproperty', + OrdinaryIsExtensible: 'https://262.ecma-international.org/12.0/#sec-ordinaryisextensible', + OrdinaryObjectCreate: 'https://262.ecma-international.org/12.0/#sec-ordinaryobjectcreate', + OrdinaryOwnPropertyKeys: 'https://262.ecma-international.org/12.0/#sec-ordinaryownpropertykeys', + OrdinaryPreventExtensions: 'https://262.ecma-international.org/12.0/#sec-ordinarypreventextensions', + OrdinarySet: 'https://262.ecma-international.org/12.0/#sec-ordinaryset', + OrdinarySetPrototypeOf: 'https://262.ecma-international.org/12.0/#sec-ordinarysetprototypeof', + OrdinarySetWithOwnDescriptor: 'https://262.ecma-international.org/12.0/#sec-ordinarysetwithowndescriptor', + OrdinaryToPrimitive: 'https://262.ecma-international.org/12.0/#sec-ordinarytoprimitive', + ParseModule: 'https://262.ecma-international.org/12.0/#sec-parsemodule', + ParsePattern: 'https://262.ecma-international.org/12.0/#sec-parsepattern', + ParseScript: 'https://262.ecma-international.org/12.0/#sec-parse-script', + ParseText: 'https://262.ecma-international.org/12.0/#sec-parsetext', + PerformEval: 'https://262.ecma-international.org/12.0/#sec-performeval', + PerformPromiseAll: 'https://262.ecma-international.org/12.0/#sec-performpromiseall', + PerformPromiseAllSettled: 'https://262.ecma-international.org/12.0/#sec-performpromiseallsettled', + PerformPromiseAny: 'https://262.ecma-international.org/12.0/#sec-performpromiseany', + PerformPromiseRace: 'https://262.ecma-international.org/12.0/#sec-performpromiserace', + PerformPromiseThen: 'https://262.ecma-international.org/12.0/#sec-performpromisethen', + PrepareForOrdinaryCall: 'https://262.ecma-international.org/12.0/#sec-prepareforordinarycall', + PrepareForTailCall: 'https://262.ecma-international.org/12.0/#sec-preparefortailcall', + PromiseResolve: 'https://262.ecma-international.org/12.0/#sec-promise-resolve', + ProxyCreate: 'https://262.ecma-international.org/12.0/#sec-proxycreate', + PutValue: 'https://262.ecma-international.org/12.0/#sec-putvalue', + QuoteJSONString: 'https://262.ecma-international.org/12.0/#sec-quotejsonstring', + RawBytesToNumeric: 'https://262.ecma-international.org/12.0/#sec-rawbytestonumeric', + 'reads-bytes-from': 'https://262.ecma-international.org/12.0/#sec-reads-bytes-from', + 'reads-from': 'https://262.ecma-international.org/12.0/#sec-reads-from', + RegExpAlloc: 'https://262.ecma-international.org/12.0/#sec-regexpalloc', + RegExpBuiltinExec: 'https://262.ecma-international.org/12.0/#sec-regexpbuiltinexec', + RegExpCreate: 'https://262.ecma-international.org/12.0/#sec-regexpcreate', + RegExpExec: 'https://262.ecma-international.org/12.0/#sec-regexpexec', + RegExpInitialize: 'https://262.ecma-international.org/12.0/#sec-regexpinitialize', + RejectPromise: 'https://262.ecma-international.org/12.0/#sec-rejectpromise', + RemoveWaiter: 'https://262.ecma-international.org/12.0/#sec-removewaiter', + RemoveWaiters: 'https://262.ecma-international.org/12.0/#sec-removewaiters', + RepeatMatcher: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-repeatmatcher-abstract-operation', + RequireInternalSlot: 'https://262.ecma-international.org/12.0/#sec-requireinternalslot', + RequireObjectCoercible: 'https://262.ecma-international.org/12.0/#sec-requireobjectcoercible', + ResolveBinding: 'https://262.ecma-international.org/12.0/#sec-resolvebinding', + ResolveThisBinding: 'https://262.ecma-international.org/12.0/#sec-resolvethisbinding', + ReturnIfAbrupt: 'https://262.ecma-international.org/12.0/#sec-returnifabrupt', + SameValue: 'https://262.ecma-international.org/12.0/#sec-samevalue', + SameValueNonNumeric: 'https://262.ecma-international.org/12.0/#sec-samevaluenonnumeric', + SameValueZero: 'https://262.ecma-international.org/12.0/#sec-samevaluezero', + ScriptEvaluation: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-scriptevaluation', + SecFromTime: 'https://262.ecma-international.org/12.0/#eqn-SecFromTime', + SerializeJSONArray: 'https://262.ecma-international.org/12.0/#sec-serializejsonarray', + SerializeJSONObject: 'https://262.ecma-international.org/12.0/#sec-serializejsonobject', + SerializeJSONProperty: 'https://262.ecma-international.org/12.0/#sec-serializejsonproperty', + Set: 'https://262.ecma-international.org/12.0/#sec-set-o-p-v-throw', + SetDefaultGlobalBindings: 'https://262.ecma-international.org/12.0/#sec-setdefaultglobalbindings', + SetFunctionLength: 'https://262.ecma-international.org/12.0/#sec-setfunctionlength', + SetFunctionName: 'https://262.ecma-international.org/12.0/#sec-setfunctionname', + SetImmutablePrototype: 'https://262.ecma-international.org/12.0/#sec-set-immutable-prototype', + SetIntegrityLevel: 'https://262.ecma-international.org/12.0/#sec-setintegritylevel', + SetRealmGlobalObject: 'https://262.ecma-international.org/12.0/#sec-setrealmglobalobject', + SetTypedArrayFromArrayLike: 'https://262.ecma-international.org/12.0/#sec-settypedarrayfromarraylike', + SetTypedArrayFromTypedArray: 'https://262.ecma-international.org/12.0/#sec-settypedarrayfromtypedarray', + SetValueInBuffer: 'https://262.ecma-international.org/12.0/#sec-setvalueinbuffer', + SetViewValue: 'https://262.ecma-international.org/12.0/#sec-setviewvalue', + SharedDataBlockEventSet: 'https://262.ecma-international.org/12.0/#sec-sharedatablockeventset', + SortCompare: 'https://262.ecma-international.org/12.0/#sec-sortcompare', + SpeciesConstructor: 'https://262.ecma-international.org/12.0/#sec-speciesconstructor', + SplitMatch: 'https://262.ecma-international.org/12.0/#sec-splitmatch', + 'Strict Equality Comparison': 'https://262.ecma-international.org/12.0/#sec-strict-equality-comparison', + StringCreate: 'https://262.ecma-international.org/12.0/#sec-stringcreate', + StringGetOwnProperty: 'https://262.ecma-international.org/12.0/#sec-stringgetownproperty', + StringIndexOf: 'https://262.ecma-international.org/12.0/#sec-stringindexof', + StringPad: 'https://262.ecma-international.org/12.0/#sec-stringpad', + StringToBigInt: 'https://262.ecma-international.org/12.0/#sec-stringtobigint', + StringToCodePoints: 'https://262.ecma-international.org/12.0/#sec-stringtocodepoints', + substring: 'https://262.ecma-international.org/12.0/#substring', + SuspendAgent: 'https://262.ecma-international.org/12.0/#sec-suspendagent', + SymbolDescriptiveString: 'https://262.ecma-international.org/12.0/#sec-symboldescriptivestring', + 'synchronizes-with': 'https://262.ecma-international.org/12.0/#sec-synchronizes-with', + TestIntegrityLevel: 'https://262.ecma-international.org/12.0/#sec-testintegritylevel', + thisBigIntValue: 'https://262.ecma-international.org/12.0/#thisbigintvalue', + thisBooleanValue: 'https://262.ecma-international.org/12.0/#thisbooleanvalue', + thisNumberValue: 'https://262.ecma-international.org/12.0/#thisnumbervalue', + thisStringValue: 'https://262.ecma-international.org/12.0/#thisstringvalue', + thisSymbolValue: 'https://262.ecma-international.org/12.0/#thissymbolvalue', + thisTimeValue: 'https://262.ecma-international.org/12.0/#thistimevalue', + ThrowCompletion: 'https://262.ecma-international.org/12.0/#sec-throwcompletion', + TimeClip: 'https://262.ecma-international.org/12.0/#sec-timeclip', + TimeFromYear: 'https://262.ecma-international.org/12.0/#eqn-TimeFromYear', + TimeString: 'https://262.ecma-international.org/12.0/#sec-timestring', + TimeWithinDay: 'https://262.ecma-international.org/12.0/#eqn-TimeWithinDay', + TimeZoneString: 'https://262.ecma-international.org/12.0/#sec-timezoneestring', + ToBigInt: 'https://262.ecma-international.org/12.0/#sec-tobigint', + ToBigInt64: 'https://262.ecma-international.org/12.0/#sec-tobigint64', + ToBigUint64: 'https://262.ecma-international.org/12.0/#sec-tobiguint64', + ToBoolean: 'https://262.ecma-international.org/12.0/#sec-toboolean', + ToDateString: 'https://262.ecma-international.org/12.0/#sec-todatestring', + ToIndex: 'https://262.ecma-international.org/12.0/#sec-toindex', + ToInt16: 'https://262.ecma-international.org/12.0/#sec-toint16', + ToInt32: 'https://262.ecma-international.org/12.0/#sec-toint32', + ToInt8: 'https://262.ecma-international.org/12.0/#sec-toint8', + ToIntegerOrInfinity: 'https://262.ecma-international.org/12.0/#sec-tointegerorinfinity', + ToLength: 'https://262.ecma-international.org/12.0/#sec-tolength', + ToNumber: 'https://262.ecma-international.org/12.0/#sec-tonumber', + ToNumeric: 'https://262.ecma-international.org/12.0/#sec-tonumeric', + ToObject: 'https://262.ecma-international.org/12.0/#sec-toobject', + ToPrimitive: 'https://262.ecma-international.org/12.0/#sec-toprimitive', + ToPropertyDescriptor: 'https://262.ecma-international.org/12.0/#sec-topropertydescriptor', + ToPropertyKey: 'https://262.ecma-international.org/12.0/#sec-topropertykey', + ToString: 'https://262.ecma-international.org/12.0/#sec-tostring', + ToUint16: 'https://262.ecma-international.org/12.0/#sec-touint16', + ToUint32: 'https://262.ecma-international.org/12.0/#sec-touint32', + ToUint8: 'https://262.ecma-international.org/12.0/#sec-touint8', + ToUint8Clamp: 'https://262.ecma-international.org/12.0/#sec-touint8clamp', + TriggerPromiseReactions: 'https://262.ecma-international.org/12.0/#sec-triggerpromisereactions', + TrimString: 'https://262.ecma-international.org/12.0/#sec-trimstring', + Type: 'https://262.ecma-international.org/12.0/#sec-ecmascript-data-types-and-values', + TypedArrayCreate: 'https://262.ecma-international.org/12.0/#typedarray-create', + TypedArraySpeciesCreate: 'https://262.ecma-international.org/12.0/#typedarray-species-create', + UnicodeEscape: 'https://262.ecma-international.org/12.0/#sec-unicodeescape', + UnicodeMatchProperty: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-unicodematchproperty-p', + UnicodeMatchPropertyValue: 'https://262.ecma-international.org/12.0/#sec-runtime-semantics-unicodematchpropertyvalue-p-v', + UpdateEmpty: 'https://262.ecma-international.org/12.0/#sec-updateempty', + UTC: 'https://262.ecma-international.org/12.0/#sec-utc-t', + UTF16EncodeCodePoint: 'https://262.ecma-international.org/12.0/#sec-utf16encodecodepoint', + UTF16SurrogatePairToCodePoint: 'https://262.ecma-international.org/12.0/#sec-utf16decodesurrogatepair', + ValidateAndApplyPropertyDescriptor: 'https://262.ecma-international.org/12.0/#sec-validateandapplypropertydescriptor', + ValidateAtomicAccess: 'https://262.ecma-international.org/12.0/#sec-validateatomicaccess', + ValidateIntegerTypedArray: 'https://262.ecma-international.org/12.0/#sec-validateintegertypedarray', + ValidateTypedArray: 'https://262.ecma-international.org/12.0/#sec-validatetypedarray', + ValueOfReadEvent: 'https://262.ecma-international.org/12.0/#sec-valueofreadevent', + WeakRefDeref: 'https://262.ecma-international.org/12.0/#sec-weakrefderef', + WeekDay: 'https://262.ecma-international.org/12.0/#sec-week-day', + YearFromTime: 'https://262.ecma-international.org/12.0/#eqn-YearFromTime', + Yield: 'https://262.ecma-international.org/12.0/#sec-yield' +}; diff --git a/docs/snippets/node_modules/es-abstract/package.json b/docs/snippets/node_modules/es-abstract/package.json index a897e651..bb84c143 100644 --- a/docs/snippets/node_modules/es-abstract/package.json +++ b/docs/snippets/node_modules/es-abstract/package.json @@ -1,28 +1,28 @@ { - "_from": "es-abstract@^1.18.0-next.2", - "_id": "es-abstract@1.18.3", + "_from": "es-abstract@^1.18.5", + "_id": "es-abstract@1.19.1", "_inBundle": false, - "_integrity": "sha512-nQIr12dxV7SSxE6r6f1l3DtAeEYdsGpps13dR0TwJg1S8gyp4ZPgy3FZcHBgbiQqnoqSTb+oC+kO4UQ0C/J8vw==", + "_integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", "_location": "/es-abstract", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "es-abstract@^1.18.0-next.2", + "raw": "es-abstract@^1.18.5", "name": "es-abstract", "escapedName": "es-abstract", - "rawSpec": "^1.18.0-next.2", + "rawSpec": "^1.18.5", "saveSpec": null, - "fetchSpec": "^1.18.0-next.2" + "fetchSpec": "^1.18.5" }, "_requiredBy": [ "/is-typed-array", "/which-typed-array" ], - "_resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.3.tgz", - "_shasum": "25c4c3380a27aa203c44b2b685bba94da31b63e0", - "_spec": "es-abstract@^1.18.0-next.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/is-typed-array", + "_resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "_shasum": "d4885796876916959de78edaa0df456627115ec3", + "_spec": "es-abstract@^1.18.5", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/is-typed-array", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", @@ -44,13 +44,17 @@ "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", "has": "^1.0.3", "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.3", - "is-string": "^1.0.6", - "object-inspect": "^1.10.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", "object-keys": "^1.1.1", "object.assign": "^4.1.2", "string.prototype.trimend": "^1.0.4", @@ -60,14 +64,15 @@ "deprecated": false, "description": "ECMAScript spec abstract operations.", "devDependencies": { - "@ljharb/eslint-config": "^17.6.0", - "array.prototype.indexof": "^1.0.2", + "@ljharb/eslint-config": "^18.0.0", + "array.prototype.filter": "^1.0.1", + "array.prototype.indexof": "^1.0.3", "aud": "^1.1.5", "cheerio": "=1.0.0-rc.3", "diff": "^5.0.0", "eclint": "^2.8.1", "es-value-fixtures": "^1.2.1", - "eslint": "^7.27.0", + "eslint": "^7.32.0", "foreach": "^2.0.5", "functions-have-names": "^1.2.2", "has-bigints": "^1.0.1", @@ -81,24 +86,11 @@ "object.fromentries": "^2.0.4", "safe-publish-latest": "^1.1.4", "ses": "^0.10.4", - "tape": "^5.2.2" + "tape": "^5.3.1" }, "engines": { "node": ">= 0.4" }, - "exports": { - ".": "./index.js", - "./package.json": "./package.json", - "./2020/*": "./2020/*.js", - "./2019/*": "./2019/*.js", - "./2018/*": "./2018/*.js", - "./2017/*": "./2017/*.js", - "./2016/*": "./2016/*.js", - "./2015/*": "./2015/*.js", - "./helpers/*": "./helpers/*.js", - "./5/*": "./5/*.js", - "./": "./" - }, "funding": { "url": "https://github.com/sponsors/ljharb" }, @@ -161,5 +153,5 @@ ] }, "type": "commonjs", - "version": "1.18.3" + "version": "1.19.1" } diff --git a/docs/snippets/node_modules/es-abstract/test/GetIntrinsic.js b/docs/snippets/node_modules/es-abstract/test/GetIntrinsic.js deleted file mode 100644 index 2f21e764..00000000 --- a/docs/snippets/node_modules/es-abstract/test/GetIntrinsic.js +++ /dev/null @@ -1,207 +0,0 @@ -'use strict'; - -var GetIntrinsic = require('get-intrinsic'); - -var test = require('tape'); -var forEach = require('foreach'); -var debug = require('object-inspect'); -var generatorFns = require('make-generator-function')(); -var asyncFns = require('make-async-function').list(); -var asyncGenFns = require('make-async-generator-function')(); - -var callBound = require('call-bind/callBound'); -var v = require('es-value-fixtures'); -var $gOPD = require('../helpers/getOwnPropertyDescriptor'); -var defineProperty = require('./helpers/defineProperty'); - -var $isProto = callBound('%Object.prototype.isPrototypeOf%'); - -test('export', function (t) { - t.equal(typeof GetIntrinsic, 'function', 'it is a function'); - t.equal(GetIntrinsic.length, 2, 'function has length of 2'); - - t.end(); -}); - -test('throws', function (t) { - t['throws']( - function () { GetIntrinsic('not an intrinsic'); }, - SyntaxError, - 'nonexistent intrinsic throws a syntax error' - ); - - t['throws']( - function () { GetIntrinsic(''); }, - TypeError, - 'empty string intrinsic throws a type error' - ); - - t['throws']( - function () { GetIntrinsic('.'); }, - SyntaxError, - '"just a dot" intrinsic throws a syntax error' - ); - - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { GetIntrinsic(nonString); }, - TypeError, - debug(nonString) + ' is not a String' - ); - }); - - forEach(v.nonBooleans, function (nonBoolean) { - t['throws']( - function () { GetIntrinsic('%', nonBoolean); }, - TypeError, - debug(nonBoolean) + ' is not a Boolean' - ); - }); - - forEach([ - 'toString', - 'propertyIsEnumerable', - 'hasOwnProperty' - ], function (objectProtoMember) { - t['throws']( - function () { GetIntrinsic(objectProtoMember); }, - SyntaxError, - debug(objectProtoMember) + ' is not an intrinsic' - ); - }); - - t.end(); -}); - -test('base intrinsics', function (t) { - t.equal(GetIntrinsic('%Object%'), Object, '%Object% yields Object'); - t.equal(GetIntrinsic('Object'), Object, 'Object yields Object'); - t.equal(GetIntrinsic('%Array%'), Array, '%Array% yields Array'); - t.equal(GetIntrinsic('Array'), Array, 'Array yields Array'); - - t.end(); -}); - -test('dotted paths', function (t) { - t.equal(GetIntrinsic('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% yields Object.prototype.toString'); - t.equal(GetIntrinsic('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString yields Object.prototype.toString'); - t.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push, '%Array.prototype.push% yields Array.prototype.push'); - t.equal(GetIntrinsic('Array.prototype.push'), Array.prototype.push, 'Array.prototype.push yields Array.prototype.push'); - - test('underscore paths are aliases for dotted paths', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { - var original = GetIntrinsic('%ObjProto_toString%'); - - forEach([ - '%Object.prototype.toString%', - 'Object.prototype.toString', - '%ObjectPrototype.toString%', - 'ObjectPrototype.toString', - '%ObjProto_toString%', - 'ObjProto_toString' - ], function (name) { - defineProperty(Object.prototype, 'toString', { - value: function toString() { - return original.apply(this, arguments); - } - }); - st.equal(GetIntrinsic(name), original, name + ' yields original Object.prototype.toString'); - }); - - defineProperty(Object.prototype, 'toString', { value: original }); - st.end(); - }); - - test('dotted paths cache', { skip: !Object.isFrozen || Object.isFrozen(Object.prototype) }, function (st) { - var original = GetIntrinsic('%Object.prototype.propertyIsEnumerable%'); - - forEach([ - '%Object.prototype.propertyIsEnumerable%', - 'Object.prototype.propertyIsEnumerable', - '%ObjectPrototype.propertyIsEnumerable%', - 'ObjectPrototype.propertyIsEnumerable' - ], function (name) { - // eslint-disable-next-line no-extend-native - Object.prototype.propertyIsEnumerable = function propertyIsEnumerable() { - return original.apply(this, arguments); - }; - st.equal(GetIntrinsic(name), original, name + ' yields cached Object.prototype.propertyIsEnumerable'); - }); - - // eslint-disable-next-line no-extend-native - Object.prototype.propertyIsEnumerable = original; - st.end(); - }); - - test('dotted path reports correct error', function (st) { - st['throws'](function () { - GetIntrinsic('%NonExistentIntrinsic.prototype.property%'); - }, /%NonExistentIntrinsic%/, 'The base intrinsic of %NonExistentIntrinsic.prototype.property% is %NonExistentIntrinsic%'); - - st['throws'](function () { - GetIntrinsic('%NonExistentIntrinsicPrototype.property%'); - }, /%NonExistentIntrinsicPrototype%/, 'The base intrinsic of %NonExistentIntrinsicPrototype.property% is %NonExistentIntrinsicPrototype%'); - - st.end(); - }); - - t.end(); -}); - -test('accessors', { skip: !$gOPD || typeof Map !== 'function' }, function (t) { - var actual = $gOPD(Map.prototype, 'size'); - t.ok(actual, 'Map.prototype.size has a descriptor'); - t.equal(typeof actual.get, 'function', 'Map.prototype.size has a getter function'); - t.equal(GetIntrinsic('%Map.prototype.size%'), actual.get, '%Map.prototype.size% yields the getter for it'); - t.equal(GetIntrinsic('Map.prototype.size'), actual.get, 'Map.prototype.size yields the getter for it'); - - t.end(); -}); - -test('generator functions', { skip: !generatorFns.length }, function (t) { - var $GeneratorFunction = GetIntrinsic('%GeneratorFunction%'); - var $GeneratorFunctionPrototype = GetIntrinsic('%Generator%'); - var $GeneratorPrototype = GetIntrinsic('%GeneratorPrototype%'); - - forEach(generatorFns, function (genFn) { - var fnName = genFn.name; - fnName = fnName ? "'" + fnName + "'" : 'genFn'; - - t.ok(genFn instanceof $GeneratorFunction, fnName + ' instanceof %GeneratorFunction%'); - t.ok($isProto($GeneratorFunctionPrototype, genFn), '%Generator% is prototype of ' + fnName); - t.ok($isProto($GeneratorPrototype, genFn.prototype), '%GeneratorPrototype% is prototype of ' + fnName + '.prototype'); - }); - - t.end(); -}); - -test('async functions', { skip: !asyncFns.length }, function (t) { - var $AsyncFunction = GetIntrinsic('%AsyncFunction%'); - var $AsyncFunctionPrototype = GetIntrinsic('%AsyncFunctionPrototype%'); - - forEach(asyncFns, function (asyncFn) { - var fnName = asyncFn.name; - fnName = fnName ? "'" + fnName + "'" : 'asyncFn'; - - t.ok(asyncFn instanceof $AsyncFunction, fnName + ' instanceof %AsyncFunction%'); - t.ok($isProto($AsyncFunctionPrototype, asyncFn), '%AsyncFunctionPrototype% is prototype of ' + fnName); - }); - - t.end(); -}); - -test('async generator functions', { skip: !asyncGenFns.length }, function (t) { - var $AsyncGeneratorFunction = GetIntrinsic('%AsyncGeneratorFunction%'); - var $AsyncGeneratorFunctionPrototype = GetIntrinsic('%AsyncGenerator%'); - var $AsyncGeneratorPrototype = GetIntrinsic('%AsyncGeneratorPrototype%'); - - forEach(asyncGenFns, function (asyncGenFn) { - var fnName = asyncGenFn.name; - fnName = fnName ? "'" + fnName + "'" : 'asyncGenFn'; - - t.ok(asyncGenFn instanceof $AsyncGeneratorFunction, fnName + ' instanceof %AsyncGeneratorFunction%'); - t.ok($isProto($AsyncGeneratorFunctionPrototype, asyncGenFn), '%AsyncGenerator% is prototype of ' + fnName); - t.ok($isProto($AsyncGeneratorPrototype, asyncGenFn.prototype), '%AsyncGeneratorPrototype% is prototype of ' + fnName + '.prototype'); - }); - - t.end(); -}); diff --git a/docs/snippets/node_modules/es-abstract/test/diffOps.js b/docs/snippets/node_modules/es-abstract/test/diffOps.js deleted file mode 100644 index 06641b18..00000000 --- a/docs/snippets/node_modules/es-abstract/test/diffOps.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -var keys = require('object-keys'); -var forEach = require('foreach'); -var indexOf = require('array.prototype.indexof'); -var has = require('has'); - -module.exports = function diffOperations(actual, expected, expectedMissing) { - var actualKeys = keys(actual); - var expectedKeys = keys(expected); - - var extra = []; - var missing = []; - var extraMissing = []; - - forEach(actualKeys, function (op) { - if (!(op in expected)) { - if (actual[op] && typeof actual[op] === 'object') { - forEach(keys(actual[op]), function (nestedOp) { - var fullNestedOp = op + '::' + nestedOp; - if (!(fullNestedOp in expected)) { - extra.push(fullNestedOp); - } else if (indexOf(expectedMissing, fullNestedOp) !== -1) { - extra.push(fullNestedOp); - } - }); - } else { - extra.push(op); - } - } else if (indexOf(expectedMissing, op) !== -1) { - extra.push(op); - } - }); - var checkMissing = function checkMissing(op, actualValue) { - if (typeof actualValue !== 'function' && indexOf(expectedMissing, op) === -1) { - missing.push(op); - } - }; - forEach(expectedKeys, function (op) { - if (op.indexOf('::') > -1) { - var parts = op.split('::'); - var value = actual[parts[0]]; - if (value && typeof value === 'object' && typeof value[parts[1]] === 'function') { - checkMissing(op, value[parts[1]]); - } - } else { - checkMissing(op, actual[op]); - } - }); - - forEach(expectedMissing, function (expectedOp) { - if (!has(expected, expectedOp)) { - extraMissing.push(expectedOp); - } - }); - - return { missing: missing, extra: extra, extraMissing: extraMissing }; -}; diff --git a/docs/snippets/node_modules/es-abstract/test/es2015.js b/docs/snippets/node_modules/es-abstract/test/es2015.js deleted file mode 100644 index 33a8ead4..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es2015.js +++ /dev/null @@ -1,144 +0,0 @@ -'use strict'; - -var ES = require('../').ES2015; -var boundES = require('./helpers/createBoundESNamespace')(ES); - -var ops = require('../operations/2015'); - -var expectedMissing = [ - 'AddRestrictedFunctionProperties', - 'AllocateArrayBuffer', - 'AllocateTypedArray', - 'BoundFunctionCreate', - 'Canonicalize', - 'CharacterRange', - 'CharacterSetMatcher', - 'CloneArrayBuffer', - 'Completion', - 'Construct', - 'CopyDataBlockBytes', - 'CreateArrayFromList', - 'CreateArrayIterator', - 'CreateBuiltinFunction', - 'CreateByteDataBlock', - 'CreateDynamicFunction', - 'CreateIntrinsics', - 'CreateListIterator', - 'CreateMapIterator', - 'CreateMappedArgumentsObject', - 'CreatePerIterationEnvironment', - 'CreateRealm', - 'CreateSetIterator', - 'CreateUnmappedArgumentsObject', - 'DaylightSavingTA', - 'Decode', - 'DetachArrayBuffer', - 'Encode', - 'EnqueueJob', - 'EscapeRegExpPattern', - 'EvalDeclarationInstantiation', - 'EvaluateCall', - 'EvaluateDirectCall', - 'EvaluateNew', - 'ForBodyEvaluation', - 'ForIn/OfBodyEvaluation', - 'ForIn/OfHeadEvaluation', - 'FulfillPromise', - 'FunctionAllocate', - 'FunctionCreate', - 'FunctionInitialize', - 'GeneratorFunctionCreate', - 'GeneratorResume', - 'GeneratorResumeAbrupt', - 'GeneratorStart', - 'GeneratorValidate', - 'GeneratorYield', - 'GetBase', - 'GetFunctionRealm', - 'GetGlobalObject', - 'GetIdentifierReference', - 'GetModuleNamespace', - 'GetNewTarget', - 'GetReferencedName', - 'GetSuperConstructor', - 'GetTemplateObject', - 'GetThisEnvironment', - 'GetThisValue', - 'GetValue', - 'GetValueFromBuffer', - 'GetViewValue', - 'HasPrimitiveBase', - 'HostResolveImportedModule', - 'ImportedLocalNames', - 'InitializeHostDefinedRealm', - 'InitializeReferencedBinding', - 'IntegerIndexedElementGet', - 'IntegerIndexedElementSet', - 'IntegerIndexedObjectCreate', - 'InternalizeJSONProperty', - 'IsAnonymousFunctionDefinition', - 'IsCompatiblePropertyDescriptor', - 'IsDetachedBuffer', - 'IsInTailPosition', - 'IsLabelledFunction', - 'IsPropertyReference', - 'IsStrictReference', - 'IsSuperReference', - 'IsUnresolvableReference', - 'IsWordChar', - 'LocalTime', - 'LoopContinues', - 'MakeArgGetter', - 'MakeArgSetter', - 'MakeClassConstructor', - 'MakeConstructor', - 'MakeMethod', - 'MakeSuperPropertyReference', - 'max', - 'min', - 'ModuleNamespaceCreate', - 'msPerDay', // constant - 'NewDeclarativeEnvironment', - 'NewFunctionEnvironment', - 'NewGlobalEnvironment', - 'NewModuleEnvironment', - 'NewObjectEnvironment', - 'NewPromiseCapability', - 'NormalCompletion', - 'ObjectDefineProperties', - 'OrdinaryCallBindThis', - 'OrdinaryCallEvaluateBody', - 'ParseModule', - 'PerformEval', - 'PerformPromiseAll', - 'PerformPromiseRace', - 'PerformPromiseThen', - 'PrepareForOrdinaryCall', - 'PrepareForTailCall', - 'ProxyCreate', - 'PutValue', // takes a Reference - 'RegExpAlloc', // creates a regex with uninitialized internal lots - 'RegExpBuiltinExec', - 'RegExpInitialize', // initializes allocated regex's internal slots - 'RejectPromise', - 'RepeatMatcher', - 'ResolveBinding', - 'ResolveThisBinding', - 'SerializeJSONArray', - 'SerializeJSONObject', - 'SerializeJSONProperty', - 'SetDefaultGlobalBindings', - 'SetRealmGlobalObject', - 'SetValueInBuffer', - 'SetViewValue', - 'sign', - 'SortCompare', // mystery access to `comparefn` arg - 'TriggerPromiseReactions', - 'TypedArrayFrom', - 'UpdateEmpty', // completion records - 'UTC' // depends on LocalTZA, DaylightSavingTA -]; - -require('./tests').es2015(boundES, ops, expectedMissing); - -require('./helpers/runManifestTest')(require('tape'), ES, 2015); diff --git a/docs/snippets/node_modules/es-abstract/test/es2016.js b/docs/snippets/node_modules/es-abstract/test/es2016.js deleted file mode 100644 index c813ac53..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es2016.js +++ /dev/null @@ -1,165 +0,0 @@ -'use strict'; - -var ES = require('../').ES2016; -var boundES = require('./helpers/createBoundESNamespace')(ES); - -var ops = require('../operations/2016'); - -var expectedMissing = [ - 'AddRestrictedFunctionProperties', - 'AllocateArrayBuffer', - 'AllocateTypedArray', - 'AllocateTypedArrayBuffer', - 'BlockDeclarationInstantiation', - 'BoundFunctionCreate', - 'Canonicalize', - 'CharacterRange', - 'CharacterRangeOrUnion', - 'CharacterSetMatcher', - 'CloneArrayBuffer', - 'Completion', - 'Construct', - 'CopyDataBlockBytes', - 'CreateArrayFromList', - 'CreateArrayIterator', - 'CreateBuiltinFunction', - 'CreateByteDataBlock', - 'CreateDynamicFunction', - 'CreateIntrinsics', - 'CreateListIterator', - 'CreateMapIterator', - 'CreateMappedArgumentsObject', - 'CreatePerIterationEnvironment', - 'CreateRealm', - 'CreateResolvingFunctions', - 'CreateSetIterator', - 'CreateStringIterator', - 'CreateUnmappedArgumentsObject', - 'DaylightSavingTA', - 'Decode', - 'DetachArrayBuffer', - 'Encode', - 'EnqueueJob', - 'EnumerateObjectProperties', - 'EscapeRegExpPattern', - 'EvalDeclarationInstantiation', - 'EvaluateCall', - 'EvaluateDirectCall', - 'EvaluateNew', - 'ForBodyEvaluation', - 'ForIn/OfBodyEvaluation', - 'ForIn/OfHeadEvaluation', - 'FulfillPromise', - 'FunctionAllocate', - 'FunctionCreate', - 'FunctionDeclarationInstantiation', - 'FunctionInitialize', - 'GeneratorFunctionCreate', - 'GeneratorResume', - 'GeneratorResumeAbrupt', - 'GeneratorStart', - 'GeneratorValidate', - 'GeneratorYield', - 'GetActiveScriptOrModule', - 'GetFunctionRealm', - 'GetGlobalObject', - 'GetIdentifierReference', - 'GetModuleNamespace', - 'GetNewTarget', - 'GetSuperConstructor', - 'GetTemplateObject', - 'GetThisEnvironment', - 'GetThisValue', - 'GetValue', - 'GetValueFromBuffer', - 'GetViewValue', - 'GlobalDeclarationInstantiation', - 'HostPromiseRejectionTracker', - 'HostReportErrors', - 'HostResolveImportedModule', - 'IfAbruptRejectPromise', - 'ImportedLocalNames', - 'InitializeBoundName', - 'InitializeHostDefinedRealm', - 'InitializeReferencedBinding', - 'IntegerIndexedElementGet', - 'IntegerIndexedElementSet', - 'IntegerIndexedObjectCreate', - 'InternalizeJSONProperty', - 'IsAnonymousFunctionDefinition', - 'IsCompatiblePropertyDescriptor', - 'IsDetachedBuffer', - 'IsInTailPosition', - 'IsLabelledFunction', - 'IsWordChar', - 'LocalTime', - 'LoopContinues', - 'MakeArgGetter', - 'MakeArgSetter', - 'MakeClassConstructor', - 'MakeConstructor', - 'MakeMethod', - 'MakeSuperPropertyReference', - 'max', - 'min', - 'ModuleNamespaceCreate', - 'NewDeclarativeEnvironment', - 'NewFunctionEnvironment', - 'NewGlobalEnvironment', - 'NewModuleEnvironment', - 'NewObjectEnvironment', - 'NewPromiseCapability', - 'NextJob', - 'NormalCompletion', - 'ObjectDefineProperties', - 'OrdinaryCallBindThis', - 'OrdinaryCallEvaluateBody', - 'OrdinaryDelete', - 'OrdinaryGet', - 'OrdinaryIsExtensible', - 'OrdinaryOwnPropertyKeys', - 'OrdinaryPreventExtensions', - 'OrdinarySet', - 'ParseModule', - 'ParseScript', - 'PerformEval', - 'PerformPromiseAll', - 'PerformPromiseRace', - 'PerformPromiseThen', - 'PrepareForOrdinaryCall', - 'PrepareForTailCall', - 'PromiseReactionJob', - 'PromiseResolveThenableJob', - 'ProxyCreate', - 'PutValue', // takes a Reference - 'RegExpAlloc', // creates a regex with uninitialized internal lots - 'RegExpBuiltinExec', - 'RegExpInitialize', // initializes allocated regex's internal slots - 'RejectPromise', - 'RepeatMatcher', - 'ResolveBinding', - 'ResolveThisBinding', - 'ReturnIfAbrupt', - 'ScriptEvaluation', - 'ScriptEvaluationJob', - 'SerializeJSONArray', - 'SerializeJSONObject', - 'SerializeJSONProperty', - 'SetDefaultGlobalBindings', - 'SetRealmGlobalObject', - 'SetValueInBuffer', - 'SetViewValue', - 'SortCompare', // mystery access to `comparefn` arg - 'TopLevelModuleEvaluationJob', - 'ToString Applied to the Number Type', - 'TriggerPromiseReactions', - 'TypedArrayCreate', - 'TypedArraySpeciesCreate', - 'UpdateEmpty', // completion records - 'UTC', // depends on LocalTZA, DaylightSavingTA - 'ValidateTypedArray' -]; - -require('./tests').es2016(boundES, ops, expectedMissing); - -require('./helpers/runManifestTest')(require('tape'), ES, 2016); diff --git a/docs/snippets/node_modules/es-abstract/test/es2017.js b/docs/snippets/node_modules/es-abstract/test/es2017.js deleted file mode 100644 index ab6ca6f9..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es2017.js +++ /dev/null @@ -1,211 +0,0 @@ -'use strict'; - -var ES = require('../').ES2017; -var boundES = require('./helpers/createBoundESNamespace')(ES); - -var ops = require('../operations/2017'); - -var expectedMissing = [ - 'AddWaiter', - 'agent-order', - 'AgentCanSuspend', - 'AgentSignifier', - 'AllocateArrayBuffer', - 'AllocateSharedArrayBuffer', - 'AllocateTypedArray', - 'AllocateTypedArrayBuffer', - 'AsyncFunctionAwait', - 'AsyncFunctionCreate', - 'AsyncFunctionStart', - 'AtomicLoad', - 'AtomicReadModifyWrite', - 'BlockDeclarationInstantiation', - 'BoundFunctionCreate', - 'Canonicalize', - 'CharacterRange', - 'CharacterRangeOrUnion', - 'CharacterSetMatcher', - 'CloneArrayBuffer', - 'Completion', - 'ComposeWriteEventBytes', - 'Construct', - 'CopyDataBlockBytes', - 'CreateArrayFromList', - 'CreateArrayIterator', - 'CreateBuiltinFunction', - 'CreateByteDataBlock', - 'CreateDynamicFunction', - 'CreateIntrinsics', - 'CreateListIterator', - 'CreateMapIterator', - 'CreateMappedArgumentsObject', - 'CreatePerIterationEnvironment', - 'CreateRealm', - 'CreateResolvingFunctions', - 'CreateSetIterator', - 'CreateSharedByteDataBlock', - 'CreateStringIterator', - 'CreateUnmappedArgumentsObject', - 'DaylightSavingTA', - 'Decode', - 'DetachArrayBuffer', - 'Encode', - 'EnqueueJob', - 'EnterCriticalSection', - 'EnumerateObjectProperties', - 'EscapeRegExpPattern', - 'EvalDeclarationInstantiation', - 'EvaluateCall', - 'EvaluateDirectCall', - 'EvaluateNew', - 'EventSet', - 'ForBodyEvaluation', - 'ForIn/OfBodyEvaluation', - 'ForIn/OfHeadEvaluation', - 'FulfillPromise', - 'FunctionAllocate', - 'FunctionCreate', - 'FunctionDeclarationInstantiation', - 'FunctionInitialize', - 'GeneratorFunctionCreate', - 'GeneratorResume', - 'GeneratorResumeAbrupt', - 'GeneratorStart', - 'GeneratorValidate', - 'GeneratorYield', - 'GetActiveScriptOrModule', - 'GetBase', - 'GetFunctionRealm', - 'GetGlobalObject', - 'GetIdentifierReference', - 'GetModifySetValueInBuffer', - 'GetModuleNamespace', - 'GetNewTarget', - 'GetReferencedName', - 'GetSuperConstructor', - 'GetTemplateObject', - 'GetThisEnvironment', - 'GetThisValue', - 'GetValue', - 'GetValueFromBuffer', - 'GetViewValue', - 'GetWaiterList', - 'GlobalDeclarationInstantiation', - 'happens-before', - 'HasPrimitiveBase', - 'host-synchronizes-with', - 'HostEnsureCanCompileStrings', - 'HostEventSet', - 'HostPromiseRejectionTracker', - 'HostReportErrors', - 'HostResolveImportedModule', - 'IfAbruptRejectPromise', - 'ImportedLocalNames', - 'InitializeBoundName', - 'InitializeHostDefinedRealm', - 'InitializeReferencedBinding', - 'IntegerIndexedElementGet', - 'IntegerIndexedElementSet', - 'IntegerIndexedObjectCreate', - 'InternalizeJSONProperty', - 'IsAnonymousFunctionDefinition', - 'IsCompatiblePropertyDescriptor', - 'IsDetachedBuffer', - 'IsInTailPosition', - 'IsLabelledFunction', - 'IsPropertyReference', - 'IsSharedArrayBuffer', - 'IsStrictReference', - 'IsSuperReference', - 'IsUnresolvableReference', - 'IsWordChar', - 'LeaveCriticalSection', - 'LocalTime', - 'LoopContinues', - 'MakeArgGetter', - 'MakeArgSetter', - 'MakeClassConstructor', - 'MakeConstructor', - 'MakeMethod', - 'MakeSuperPropertyReference', - 'max', - 'memory-order', - 'min', - 'ModuleNamespaceCreate', - 'NewDeclarativeEnvironment', - 'NewFunctionEnvironment', - 'NewGlobalEnvironment', - 'NewModuleEnvironment', - 'NewObjectEnvironment', - 'NewPromiseCapability', - 'NormalCompletion', - 'NumberToRawBytes', - 'ObjectDefineProperties', - 'OrdinaryCallBindThis', - 'OrdinaryCallEvaluateBody', - 'OrdinaryDelete', - 'OrdinaryGet', - 'OrdinaryIsExtensible', - 'OrdinaryOwnPropertyKeys', - 'OrdinaryPreventExtensions', - 'OrdinarySet', - 'OrdinaryToPrimitive', - 'ParseModule', - 'ParseScript', - 'PerformEval', - 'PerformPromiseAll', - 'PerformPromiseRace', - 'PerformPromiseThen', - 'PrepareForOrdinaryCall', - 'PrepareForTailCall', - 'PromiseReactionJob', - 'PromiseResolveThenableJob', - 'ProxyCreate', - 'PutValue', // takes a Reference - 'RawBytesToNumber', - 'reads-bytes-from', - 'reads-from', - 'RegExpAlloc', // creates a regex with uninitialized internal lots - 'RegExpBuiltinExec', - 'RegExpInitialize', // initializes allocated regex's internal slots - 'RejectPromise', - 'RemoveWaiter', - 'RemoveWaiters', - 'RepeatMatcher', - 'ResolveBinding', - 'ResolveThisBinding', - 'ReturnIfAbrupt', - 'RunJobs', - 'ScriptEvaluation', - 'ScriptEvaluationJob', - 'SerializeJSONArray', - 'SerializeJSONObject', - 'SerializeJSONProperty', - 'SetDefaultGlobalBindings', - 'SetImmutablePrototype', - 'SetRealmGlobalObject', - 'SetValueInBuffer', - 'SetViewValue', - 'SharedDataBlockEventSet', - 'SortCompare', // mystery access to `comparefn` arg - 'Suspend', - 'TopLevelModuleEvaluationJob', - 'ToString Applied to the Number Type', - 'TriggerPromiseReactions', - 'TypedArrayCreate', - 'TypedArraySpeciesCreate', - 'UpdateEmpty', // completion records - 'UTC', // depends on LocalTZA, DaylightSavingTA - 'ValidateAtomicAccess', - 'ValidateSharedIntegerTypedArray', - 'ValidateTypedArray', - 'ValueOfReadEvent', - 'WakeWaiter', - 'WordCharacters', // depends on Canonicalize - 'AddRestrictedFunctionProperties', - 'synchronizes-with' -]; - -require('./tests').es2017(boundES, ops, expectedMissing); - -require('./helpers/runManifestTest')(require('tape'), ES, 2017); diff --git a/docs/snippets/node_modules/es-abstract/test/es2018.js b/docs/snippets/node_modules/es-abstract/test/es2018.js deleted file mode 100644 index 112e9589..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es2018.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -var ES = require('../').ES2018; -var boundES = require('./helpers/createBoundESNamespace')(ES); - -var ops = require('../operations/2018'); - -var expectedMissing = [ - 'AddRestrictedFunctionProperties', - 'AddWaiter', - 'agent-order', - 'AgentCanSuspend', - 'AgentSignifier', - 'AllocateArrayBuffer', - 'AllocateSharedArrayBuffer', - 'AllocateTypedArray', - 'AllocateTypedArrayBuffer', - 'AsyncFunctionCreate', - 'AsyncFunctionStart', - 'AsyncGeneratorEnqueue', - 'AsyncGeneratorFunctionCreate', - 'AsyncGeneratorReject', - 'AsyncGeneratorResolve', - 'AsyncGeneratorResumeNext', - 'AsyncGeneratorStart', - 'AsyncGeneratorYield', - 'AsyncIteratorClose', - 'AtomicLoad', - 'AtomicReadModifyWrite', - 'Await', - 'BackreferenceMatcher', - 'BlockDeclarationInstantiation', - 'BoundFunctionCreate', - 'Canonicalize', - 'CaseClauseIsSelected', - 'CharacterRange', - 'CharacterRangeOrUnion', - 'CharacterSetMatcher', - 'CloneArrayBuffer', - 'Completion', - 'ComposeWriteEventBytes', - 'Construct', - 'CopyDataBlockBytes', - 'CreateArrayFromList', - 'CreateArrayIterator', - 'CreateAsyncFromSyncIterator', - 'CreateBuiltinFunction', - 'CreateByteDataBlock', - 'CreateDynamicFunction', - 'CreateIntrinsics', - 'CreateListIteratorRecord', - 'CreateMapIterator', - 'CreateMappedArgumentsObject', - 'CreatePerIterationEnvironment', - 'CreateRealm', - 'CreateResolvingFunctions', - 'CreateSetIterator', - 'CreateSharedByteDataBlock', - 'CreateStringIterator', - 'CreateUnmappedArgumentsObject', - 'Decode', - 'DetachArrayBuffer', - 'Encode', - 'EnqueueJob', - 'EnterCriticalSection', - 'EnumerateObjectProperties', - 'EscapeRegExpPattern', - 'EvalDeclarationInstantiation', - 'EvaluateCall', - 'EvaluateNew', - 'EventSet', - 'ForBodyEvaluation', - 'ForIn/OfBodyEvaluation', - 'ForIn/OfHeadEvaluation', - 'FulfillPromise', - 'FunctionAllocate', - 'FunctionCreate', - 'FunctionDeclarationInstantiation', - 'FunctionInitialize', - 'GeneratorFunctionCreate', - 'GeneratorResume', - 'GeneratorResumeAbrupt', - 'GeneratorStart', - 'GeneratorValidate', - 'GeneratorYield', - 'GetActiveScriptOrModule', - 'GetBase', - 'GetFunctionRealm', - 'GetGeneratorKind', - 'GetGlobalObject', - 'GetIdentifierReference', - 'GetModifySetValueInBuffer', - 'GetModuleNamespace', - 'GetNewTarget', - 'GetReferencedName', - 'GetSuperConstructor', - 'GetTemplateObject', - 'GetThisEnvironment', - 'GetThisValue', - 'GetValue', - 'GetValueFromBuffer', - 'GetViewValue', - 'GetWaiterList', - 'GlobalDeclarationInstantiation', - 'happens-before', - 'HasPrimitiveBase', - 'host-synchronizes-with', - 'HostEnsureCanCompileStrings', - 'HostEventSet', - 'HostPromiseRejectionTracker', - 'HostReportErrors', - 'HostResolveImportedModule', - 'IfAbruptRejectPromise', - 'ImportedLocalNames', - 'InitializeBoundName', - 'InitializeHostDefinedRealm', - 'InitializeReferencedBinding', - 'InnerModuleEvaluation', - 'InnerModuleInstantiation', - 'IntegerIndexedElementGet', - 'IntegerIndexedElementSet', - 'IntegerIndexedObjectCreate', - 'InternalizeJSONProperty', - 'IsAnonymousFunctionDefinition', - 'IsCompatiblePropertyDescriptor', - 'IsDetachedBuffer', - 'IsInTailPosition', - 'IsLabelledFunction', - 'IsPropertyReference', - 'IsSharedArrayBuffer', - 'IsStrictReference', - 'IsSuperReference', - 'IsUnresolvableReference', - 'IsWordChar', - 'LeaveCriticalSection', - 'LocalTime', - 'LoopContinues', - 'MakeArgGetter', - 'MakeArgSetter', - 'MakeClassConstructor', - 'MakeConstructor', - 'MakeMethod', - 'MakeSuperPropertyReference', - 'max', - 'memory-order', - 'min', - 'ModuleDeclarationEnvironmentSetup', - 'ModuleExecution', - 'ModuleNamespaceCreate', - 'NewDeclarativeEnvironment', - 'NewFunctionEnvironment', - 'NewGlobalEnvironment', - 'NewModuleEnvironment', - 'NewObjectEnvironment', - 'NewPromiseCapability', - 'NormalCompletion', - 'NumberToRawBytes', - 'ObjectDefineProperties', - 'OrdinaryCallBindThis', - 'OrdinaryCallEvaluateBody', - 'OrdinaryDelete', - 'OrdinaryGet', - 'OrdinaryIsExtensible', - 'OrdinaryOwnPropertyKeys', - 'OrdinaryPreventExtensions', - 'OrdinarySet', - 'OrdinarySetWithOwnDescriptor', - 'OrdinaryToPrimitive', - 'ParseModule', - 'ParseScript', - 'PerformEval', - 'PerformPromiseAll', - 'PerformPromiseRace', - 'PerformPromiseThen', - 'PrepareForOrdinaryCall', - 'PrepareForTailCall', - 'PromiseReactionJob', - 'PromiseResolveThenableJob', - 'ProxyCreate', - 'PutValue', // takes a Reference - 'RawBytesToNumber', - 'reads-bytes-from', - 'reads-from', - 'RegExpAlloc', // creates a regex with uninitialized internal lots - 'RegExpBuiltinExec', - 'RegExpInitialize', // initializes allocated regex's internal slots - 'RejectPromise', - 'RemoveWaiter', - 'RemoveWaiters', - 'RepeatMatcher', - 'ResolveBinding', - 'ResolveThisBinding', - 'ReturnIfAbrupt', - 'RunJobs', - 'ScriptEvaluation', - 'ScriptEvaluationJob', - 'SerializeJSONArray', - 'SerializeJSONObject', - 'SerializeJSONProperty', - 'SetDefaultGlobalBindings', - 'SetImmutablePrototype', - 'SetRealmGlobalObject', - 'SetValueInBuffer', - 'SetViewValue', - 'SharedDataBlockEventSet', - 'SortCompare', // mystery access to `comparefn` arg - 'Suspend', - 'synchronizes-with', - 'ThrowCompletion', - 'TimeZoneString', - 'TopLevelModuleEvaluationJob', - 'TriggerPromiseReactions', - 'TypedArrayCreate', - 'TypedArraySpeciesCreate', - 'UnicodeMatchProperty', - 'UnicodeMatchPropertyValue', - 'UpdateEmpty', // completion records - 'UTC', // depends on LocalTZA - 'ValidateAtomicAccess', - 'ValidateSharedIntegerTypedArray', - 'ValidateTypedArray', - 'ValueOfReadEvent', - 'WakeWaiter', - 'WordCharacters' // depends on Canonicalize -]; - -require('./tests').es2018(boundES, ops, expectedMissing); - -require('./helpers/runManifestTest')(require('tape'), ES, 2018); diff --git a/docs/snippets/node_modules/es-abstract/test/es2019.js b/docs/snippets/node_modules/es-abstract/test/es2019.js deleted file mode 100644 index a7cc84af..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es2019.js +++ /dev/null @@ -1,231 +0,0 @@ -'use strict'; - -var ES = require('../').ES2019; -var boundES = require('./helpers/createBoundESNamespace')(ES); - -var ops = require('../operations/2019'); - -var expectedMissing = [ - 'AddRestrictedFunctionProperties', - 'AddWaiter', - 'agent-order', - 'AgentCanSuspend', - 'AgentSignifier', - 'AllocateArrayBuffer', - 'AllocateSharedArrayBuffer', - 'AllocateTypedArray', - 'AllocateTypedArrayBuffer', - 'AsyncFromSyncIteratorContinuation', - 'AsyncFunctionCreate', - 'AsyncFunctionStart', - 'AsyncGeneratorEnqueue', - 'AsyncGeneratorFunctionCreate', - 'AsyncGeneratorReject', - 'AsyncGeneratorResolve', - 'AsyncGeneratorResumeNext', - 'AsyncGeneratorStart', - 'AsyncGeneratorYield', - 'AsyncIteratorClose', - 'AtomicLoad', - 'AtomicReadModifyWrite', - 'Await', - 'BackreferenceMatcher', - 'BlockDeclarationInstantiation', - 'BoundFunctionCreate', - 'Canonicalize', - 'CaseClauseIsSelected', - 'CharacterRange', - 'CharacterRangeOrUnion', - 'CharacterSetMatcher', - 'CloneArrayBuffer', - 'Completion', - 'ComposeWriteEventBytes', - 'Construct', - 'CopyDataBlockBytes', - 'CreateArrayFromList', - 'CreateArrayIterator', - 'CreateAsyncFromSyncIterator', - 'CreateBuiltinFunction', - 'CreateByteDataBlock', - 'CreateDynamicFunction', - 'CreateIntrinsics', - 'CreateListIteratorRecord', - 'CreateMapIterator', - 'CreateMappedArgumentsObject', - 'CreatePerIterationEnvironment', - 'CreateRealm', - 'CreateResolvingFunctions', - 'CreateSetIterator', - 'CreateSharedByteDataBlock', - 'CreateStringIterator', - 'CreateUnmappedArgumentsObject', - 'Decode', - 'DetachArrayBuffer', - 'Encode', - 'EnqueueJob', - 'EnterCriticalSection', - 'EnumerateObjectProperties', - 'EscapeRegExpPattern', - 'EvalDeclarationInstantiation', - 'EvaluateCall', - 'EvaluateNew', - 'EventSet', - 'ExecuteModule', - 'ForBodyEvaluation', - 'ForIn/OfBodyEvaluation', - 'ForIn/OfHeadEvaluation', - 'FulfillPromise', - 'FunctionAllocate', - 'FunctionCreate', - 'FunctionDeclarationInstantiation', - 'FunctionInitialize', - 'GeneratorFunctionCreate', - 'GeneratorResume', - 'GeneratorResumeAbrupt', - 'GeneratorStart', - 'GeneratorValidate', - 'GeneratorYield', - 'GetActiveScriptOrModule', - 'GetBase', - 'GetFunctionRealm', - 'GetGeneratorKind', - 'GetGlobalObject', - 'GetIdentifierReference', - 'GetModifySetValueInBuffer', - 'GetModuleNamespace', - 'GetNewTarget', - 'GetReferencedName', - 'GetSuperConstructor', - 'GetTemplateObject', - 'GetThisEnvironment', - 'GetThisValue', - 'GetValue', - 'GetValueFromBuffer', - 'GetViewValue', - 'GetWaiterList', - 'GlobalDeclarationInstantiation', - 'happens-before', - 'HasPrimitiveBase', - 'host-synchronizes-with', - 'HostEnsureCanCompileStrings', - 'HostEventSet', - 'HostPromiseRejectionTracker', - 'HostReportErrors', - 'HostResolveImportedModule', - 'IfAbruptRejectPromise', - 'ImportedLocalNames', - 'InitializeBoundName', - 'InitializeEnvironment', - 'InitializeHostDefinedRealm', - 'InitializeReferencedBinding', - 'InnerModuleEvaluation', - 'InnerModuleInstantiation', - 'IntegerIndexedElementGet', - 'IntegerIndexedElementSet', - 'IntegerIndexedObjectCreate', - 'InternalizeJSONProperty', - 'IsAnonymousFunctionDefinition', - 'IsCompatiblePropertyDescriptor', - 'IsDetachedBuffer', - 'IsInTailPosition', - 'IsLabelledFunction', - 'IsPropertyReference', - 'IsSharedArrayBuffer', - 'IsStrictReference', - 'IsSuperReference', - 'IsUnresolvableReference', - 'IsWordChar', - 'LeaveCriticalSection', - 'LocalTime', - 'LoopContinues', - 'MakeArgGetter', - 'MakeArgSetter', - 'MakeClassConstructor', - 'MakeConstructor', - 'MakeMethod', - 'MakeSuperPropertyReference', - 'max', - 'memory-order', - 'min', - 'ModuleNamespaceCreate', - 'NewDeclarativeEnvironment', - 'NewFunctionEnvironment', - 'NewGlobalEnvironment', - 'NewModuleEnvironment', - 'NewObjectEnvironment', - 'NewPromiseCapability', - 'NormalCompletion', - 'NotifyWaiter', - 'NumberToRawBytes', - 'ObjectDefineProperties', - 'OrdinaryCallBindThis', - 'OrdinaryCallEvaluateBody', - 'OrdinaryDelete', - 'OrdinaryGet', - 'OrdinaryIsExtensible', - 'OrdinaryOwnPropertyKeys', - 'OrdinaryPreventExtensions', - 'OrdinarySet', - 'OrdinarySetWithOwnDescriptor', - 'OrdinaryToPrimitive', - 'ParseModule', - 'ParseScript', - 'PerformEval', - 'PerformPromiseAll', - 'PerformPromiseRace', - 'PerformPromiseThen', - 'PrepareForOrdinaryCall', - 'PrepareForTailCall', - 'PromiseReactionJob', - 'PromiseResolveThenableJob', - 'ProxyCreate', - 'PutValue', // takes a Reference - 'RawBytesToNumber', - 'reads-bytes-from', - 'reads-from', - 'RegExpAlloc', // creates a regex with uninitialized internal lots - 'RegExpBuiltinExec', - 'RegExpInitialize', // initializes allocated regex's internal slots - 'RejectPromise', - 'RemoveWaiter', - 'RemoveWaiters', - 'RepeatMatcher', - 'ResolveBinding', - 'ResolveThisBinding', - 'ReturnIfAbrupt', - 'RunJobs', - 'ScriptEvaluation', - 'ScriptEvaluationJob', - 'SerializeJSONArray', - 'SerializeJSONObject', - 'SerializeJSONProperty', - 'SetDefaultGlobalBindings', - 'SetImmutablePrototype', - 'SetRealmGlobalObject', - 'SetValueInBuffer', - 'SetViewValue', - 'SharedDataBlockEventSet', - 'SortCompare', // mystery access to `comparefn` arg - 'Suspend', - 'SynchronizeEventSet', - 'synchronizes-with', - 'ThrowCompletion', - 'TimeZoneString', - 'TopLevelModuleEvaluationJob', - 'TriggerPromiseReactions', - 'TypedArrayCreate', - 'TypedArraySpeciesCreate', - 'UnicodeMatchProperty', - 'UnicodeMatchPropertyValue', - 'UpdateEmpty', // completion records - 'UTC', // depends on LocalTZA - 'ValidateAtomicAccess', - 'ValidateSharedIntegerTypedArray', - 'ValidateTypedArray', - 'ValueOfReadEvent', - 'WordCharacters' // depends on Canonicalize -]; - -require('./tests').es2019(boundES, ops, expectedMissing); - -require('./helpers/runManifestTest')(require('tape'), ES, 2019); diff --git a/docs/snippets/node_modules/es-abstract/test/es2020.js b/docs/snippets/node_modules/es-abstract/test/es2020.js deleted file mode 100644 index 83f0b3ae..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es2020.js +++ /dev/null @@ -1,240 +0,0 @@ -'use strict'; - -var ES = require('../').ES2020; -var boundES = require('./helpers/createBoundESNamespace')(ES); - -var ops = require('../operations/2020'); - -var expectedMissing = [ - 'AddRestrictedFunctionProperties', - 'AddWaiter', - 'agent-order', - 'AgentCanSuspend', - 'AgentSignifier', - 'AllocateArrayBuffer', - 'AllocateSharedArrayBuffer', - 'AllocateTypedArray', - 'AllocateTypedArrayBuffer', - 'AsyncFromSyncIteratorContinuation', - 'AsyncFunctionStart', - 'AsyncGeneratorEnqueue', - 'AsyncGeneratorReject', - 'AsyncGeneratorResolve', - 'AsyncGeneratorResumeNext', - 'AsyncGeneratorStart', - 'AsyncGeneratorYield', - 'AsyncIteratorClose', - 'AtomicLoad', - 'AtomicReadModifyWrite', - 'Await', - 'BackreferenceMatcher', - 'BlockDeclarationInstantiation', - 'BoundFunctionCreate', - 'Canonicalize', - 'CaseClauseIsSelected', - 'CharacterRange', - 'CharacterRangeOrUnion', - 'CharacterSetMatcher', - 'CloneArrayBuffer', - 'Completion', - 'ComposeWriteEventBytes', - 'Construct', - 'CopyDataBlockBytes', - 'CreateArrayFromList', - 'CreateArrayIterator', - 'CreateAsyncFromSyncIterator', - 'CreateBuiltinFunction', - 'CreateByteDataBlock', - 'CreateDynamicFunction', - 'CreateForInIterator', - 'CreateIntrinsics', - 'CreateListIteratorRecord', - 'CreateMapIterator', - 'CreateMappedArgumentsObject', - 'CreatePerIterationEnvironment', - 'CreateRealm', - 'CreateRegExpStringIterator', - 'CreateResolvingFunctions', - 'CreateSetIterator', - 'CreateSharedByteDataBlock', - 'CreateStringIterator', - 'CreateUnmappedArgumentsObject', - 'Decode', - 'DetachArrayBuffer', - 'Encode', - 'EnterCriticalSection', - 'EnumerateObjectProperties', - 'EscapeRegExpPattern', - 'EvalDeclarationInstantiation', - 'EvaluateCall', - 'EvaluateNew', - 'EvaluatePropertyAccessWithExpressionKey', - 'EvaluatePropertyAccessWithIdentifierKey', - 'EventSet', - 'ExecuteModule', - 'FinishDynamicImport', - 'ForBodyEvaluation', - 'ForIn/OfBodyEvaluation', - 'ForIn/OfHeadEvaluation', - 'FulfillPromise', - 'FunctionDeclarationInstantiation', - 'GeneratorResume', - 'GeneratorResumeAbrupt', - 'GeneratorStart', - 'GeneratorValidate', - 'GeneratorYield', - 'GetActiveScriptOrModule', - 'GetBase', - 'GetFunctionRealm', - 'GetGeneratorKind', - 'GetGlobalObject', - 'GetIdentifierReference', - 'GetModifySetValueInBuffer', - 'GetModuleNamespace', - 'GetNewTarget', - 'GetReferencedName', - 'GetSuperConstructor', - 'GetTemplateObject', - 'GetThisEnvironment', - 'GetThisValue', - 'GetValue', - 'GetValueFromBuffer', - 'GetViewValue', - 'GetWaiterList', - 'GlobalDeclarationInstantiation', - 'happens-before', - 'HasPrimitiveBase', - 'host-synchronizes-with', - 'HostEnqueuePromiseJob', - 'HostEnsureCanCompileStrings', - 'HostEventSet', - 'HostFinalizeImportMeta', - 'HostGetImportMetaProperties', - 'HostImportModuleDynamically', - 'HostPromiseRejectionTracker', - 'HostResolveImportedModule', - 'IfAbruptRejectPromise', - 'ImportedLocalNames', - 'InitializeBoundName', - 'InitializeEnvironment', - 'InitializeHostDefinedRealm', - 'InitializeReferencedBinding', - 'InnerModuleEvaluation', - 'InnerModuleLinking', - 'IntegerIndexedElementGet', - 'IntegerIndexedElementSet', - 'IntegerIndexedObjectCreate', - 'InternalizeJSONProperty', - 'IsAnonymousFunctionDefinition', - 'IsCompatiblePropertyDescriptor', - 'IsDetachedBuffer', - 'IsInTailPosition', - 'IsLabelledFunction', - 'IsPropertyReference', - 'IsSharedArrayBuffer', - 'IsStrictReference', - 'IsSuperReference', - 'IsUnresolvableReference', - 'IsValidIntegerIndex', - 'IsValidRegularExpressionLiteral', - 'IsWordChar', - 'LeaveCriticalSection', - 'LocalTime', - 'LocalTZA', - 'LoopContinues', - 'MakeArgGetter', - 'MakeArgSetter', - 'MakeBasicObject', - 'MakeClassConstructor', - 'MakeConstructor', - 'MakeMethod', - 'MakeSuperPropertyReference', - 'max', - 'memory-order', - 'min', - 'ModuleNamespaceCreate', - 'NewDeclarativeEnvironment', - 'NewFunctionEnvironment', - 'NewGlobalEnvironment', - 'NewModuleEnvironment', - 'NewObjectEnvironment', - 'NewPromiseCapability', - 'NewPromiseReactionJob', - 'NewPromiseResolveThenableJob', - 'NormalCompletion', - 'NotifyWaiter', - 'NumericToRawBytes', - 'ObjectDefineProperties', - 'OrdinaryCallBindThis', - 'OrdinaryCallEvaluateBody', - 'OrdinaryDelete', - 'OrdinaryFunctionCreate', - 'OrdinaryGet', - 'OrdinaryIsExtensible', - 'OrdinaryOwnPropertyKeys', - 'OrdinaryPreventExtensions', - 'OrdinarySet', - 'OrdinarySetWithOwnDescriptor', - 'OrdinaryToPrimitive', - 'ParseModule', - 'ParseScript', - 'PerformEval', - 'PerformPromiseAll', - 'PerformPromiseAllSettled', - 'PerformPromiseRace', - 'PerformPromiseThen', - 'PrepareForOrdinaryCall', - 'PrepareForTailCall', - 'ProxyCreate', - 'PutValue', // takes a Reference - 'RawBytesToNumeric', - 'reads-bytes-from', - 'reads-from', - 'RegExpAlloc', // creates a regex with uninitialized internal lots - 'RegExpBuiltinExec', - 'RegExpInitialize', // initializes allocated regex's internal slots - 'RejectPromise', - 'RemoveWaiter', - 'RemoveWaiters', - 'RepeatMatcher', - 'RequireInternalSlot', - 'ResolveBinding', - 'ResolveThisBinding', - 'ReturnIfAbrupt', - 'ScriptEvaluation', - 'SerializeJSONArray', - 'SerializeJSONObject', - 'SerializeJSONProperty', - 'SetDefaultGlobalBindings', - 'SetImmutablePrototype', - 'SetRealmGlobalObject', - 'SetValueInBuffer', - 'SetViewValue', - 'SharedDataBlockEventSet', - 'SortCompare', // mystery access to `comparefn` arg - 'StringToBigInt', - 'Suspend', - 'synchronizes-with', - 'ThrowCompletion', - 'TimeZoneString', - 'ToBigInt', - 'ToBigInt64', - 'ToBigUint64', - 'TriggerPromiseReactions', - 'TypedArrayCreate', - 'TypedArraySpeciesCreate', - 'UnicodeMatchProperty', - 'UnicodeMatchPropertyValue', - 'UpdateEmpty', // completion records - 'UTC', // depends on LocalTZA - 'UTF16Encode', - 'ValidateAtomicAccess', - 'ValidateSharedIntegerTypedArray', - 'ValidateTypedArray', - 'ValueOfReadEvent', - 'WordCharacters' // depends on Canonicalize -]; - -require('./tests').es2020(boundES, ops, expectedMissing); - -require('./helpers/runManifestTest')(require('tape'), ES, 2020); diff --git a/docs/snippets/node_modules/es-abstract/test/es5.js b/docs/snippets/node_modules/es-abstract/test/es5.js deleted file mode 100644 index c4033f67..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es5.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -var ES = require('../').ES5; -var boundES = require('./helpers/createBoundESNamespace')(ES); - -var ops = require('../operations/es5'); - -var expectedMissing = [ - 'SplitMatch' -]; - -require('./tests').es5(boundES, ops, expectedMissing); - -require('./helpers/runManifestTest')(require('tape'), ES, 5); diff --git a/docs/snippets/node_modules/es-abstract/test/es6.js b/docs/snippets/node_modules/es-abstract/test/es6.js deleted file mode 100644 index e7c9d98a..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es6.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -var test = require('tape'); - -var ES = require('../'); -var ES6 = ES.ES6; -var ES2015 = ES.ES2015; -var ES6entry = require('../es6'); - -test('legacy es6 export', function (t) { - t.equal(ES6, ES2015, 'main ES6 === main ES2015'); - t.end(); -}); - -test('legacy es6 entry point', function (t) { - t.equal(ES6, ES6entry, 'main ES6 === ES6 entry point'); - t.end(); -}); diff --git a/docs/snippets/node_modules/es-abstract/test/es7.js b/docs/snippets/node_modules/es-abstract/test/es7.js deleted file mode 100644 index ee57e153..00000000 --- a/docs/snippets/node_modules/es-abstract/test/es7.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -var test = require('tape'); - -var ES = require('../'); -var ES7 = ES.ES7; -var ES2016 = ES.ES2016; -var ES7entry = require('../es7'); - -test('legacy es7 export', function (t) { - t.equal(ES7, ES2016, 'main ES7 === main ES2016'); - t.end(); -}); - -test('legacy es7 entry point', function (t) { - t.equal(ES7, ES7entry, 'main ES7 === ES7 entry point'); - t.end(); -}); diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/OwnPropertyKeys.js b/docs/snippets/node_modules/es-abstract/test/helpers/OwnPropertyKeys.js deleted file mode 100644 index 9c2b4fc4..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/OwnPropertyKeys.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -var test = require('tape'); -var hasSymbols = require('has-symbols')(); - -var OwnPropertyKeys = require('../../helpers/OwnPropertyKeys'); -var defineProperty = require('./defineProperty'); - -test('OwnPropertyKeys', function (t) { - t.deepEqual(OwnPropertyKeys({ a: 1, b: 2 }).sort(), ['a', 'b'].sort(), 'returns own string keys'); - - t.test('Symbols', { skip: !hasSymbols }, function (st) { - var o = { a: 1 }; - var sym = Symbol(); - o[sym] = 2; - - st.deepEqual(OwnPropertyKeys(o), ['a', sym], 'returns own string and symbol keys'); - - st.end(); - }); - - t.test('non-enumerables', { skip: !defineProperty.oDP }, function (st) { - var o = { a: 1, b: 42, c: NaN }; - defineProperty(o, 'b', { enumerable: false, value: 42 }); - defineProperty(o, 'c', { enumerable: false, get: function () { return NaN; } }); - - if (hasSymbols) { - defineProperty(o, 'd', { enumerable: false, value: true }); - defineProperty(o, 'e', { enumerable: false, get: function () { return true; } }); - } - - st.deepEqual( - OwnPropertyKeys(o).sort(), - (hasSymbols ? ['a', 'b', 'c', 'd', 'e'] : ['a', 'b', 'c']).sort(), - 'returns non-enumerable own keys, including accessors and symbols if available' - ); - - st.end(); - }); - - t.end(); -}); diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/assertRecord.js b/docs/snippets/node_modules/es-abstract/test/helpers/assertRecord.js deleted file mode 100644 index 02311013..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/assertRecord.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -var forEach = require('foreach'); -var debug = require('object-inspect'); - -var assertRecord = require('../../helpers/assertRecord'); -var v = require('es-value-fixtures'); - -module.exports = function assertRecordTests(ES, test) { - test('Property Descriptor', function (t) { - var record = 'Property Descriptor'; - - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { assertRecord(ES.Type, record, 'arg', primitive); }, - TypeError, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - t['throws']( - function () { assertRecord(ES.Type, record, 'arg', { invalid: true }); }, - TypeError, - 'invalid keys not allowed on a Property Descriptor' - ); - - t.doesNotThrow( - function () { assertRecord(ES.Type, record, 'arg', {}); }, - 'empty object is an incomplete Property Descriptor' - ); - - t.doesNotThrow( - function () { assertRecord(ES.Type, record, 'arg', v.accessorDescriptor()); }, - 'accessor descriptor is a Property Descriptor' - ); - - t.doesNotThrow( - function () { assertRecord(ES.Type, record, 'arg', v.mutatorDescriptor()); }, - 'mutator descriptor is a Property Descriptor' - ); - - t.doesNotThrow( - function () { assertRecord(ES.Type, record, 'arg', v.dataDescriptor()); }, - 'data descriptor is a Property Descriptor' - ); - - t.doesNotThrow( - function () { assertRecord(ES.Type, record, 'arg', v.genericDescriptor()); }, - 'generic descriptor is a Property Descriptor' - ); - - t['throws']( - function () { assertRecord(ES.Type, record, 'arg', v.bothDescriptor()); }, - TypeError, - 'a Property Descriptor can not be both a Data and an Accessor Descriptor' - ); - - t.end(); - }); -}; diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/createBoundESNamespace.js b/docs/snippets/node_modules/es-abstract/test/helpers/createBoundESNamespace.js deleted file mode 100644 index 0150404d..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/createBoundESNamespace.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); - -var OwnPropertyKeys = require('../../helpers/OwnPropertyKeys'); - -module.exports = function createBoundESNamespace(ES) { - var keys = OwnPropertyKeys(ES); - var result = {}; - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var prop = ES[key]; - if (typeof prop === 'function') { - prop = bind.call(prop, undefined); - } else if (prop && typeof prop === 'object') { - prop = createBoundESNamespace(prop); - } - result[key] = prop; - } - - return result; -}; diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/defineProperty.js b/docs/snippets/node_modules/es-abstract/test/helpers/defineProperty.js deleted file mode 100644 index 03102a83..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/defineProperty.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -var GetIntrinsic = require('../../GetIntrinsic'); - -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); - -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - -module.exports = function defineProperty(O, P, Desc) { - if ($defineProperty) { - return $defineProperty(O, P, Desc); - } - if ((Desc.enumerable && Desc.configurable && Desc.writable) || !(P in O)) { - O[P] = Desc.value; // eslint-disable-line no-param-reassign - return O; - } - - throw new SyntaxError('helper does not yet support this configuration'); -}; -module.exports.oDP = $defineProperty; diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/index.js b/docs/snippets/node_modules/es-abstract/test/helpers/index.js deleted file mode 100644 index 4260bc2f..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/index.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - -require('./getSymbolDescription'); -require('./isByteValue'); -require('./isCodePoint'); -require('./OwnPropertyKeys'); diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/isByteValue.js b/docs/snippets/node_modules/es-abstract/test/helpers/isByteValue.js deleted file mode 100644 index f8949102..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/isByteValue.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -var test = require('tape'); -var forEach = require('foreach'); -var debug = require('object-inspect'); - -var isByteValue = require('../../helpers/isByteValue'); -var v = require('es-value-fixtures'); - -test('isByteValue', function (t) { - forEach([].concat( - v.notNonNegativeIntegers, - -1, - -42, - -Infinity, - Infinity, - v.nonIntegerNumbers - ), function (nonByteValue) { - t.equal(isByteValue(nonByteValue), false, debug(nonByteValue) + ' is not a byte value'); - }); - - for (var i = 0; i <= 255; i += 1) { - t.equal(isByteValue(i), true, i + ' is a byte value'); - } - t.equal(isByteValue(256), false, '256 is not a byte value'); - - t.end(); -}); diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/isCodePoint.js b/docs/snippets/node_modules/es-abstract/test/helpers/isCodePoint.js deleted file mode 100644 index 9106615a..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/isCodePoint.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var test = require('tape'); -var forEach = require('foreach'); -var debug = require('object-inspect'); - -var isCodePoint = require('../../helpers/isCodePoint'); -var v = require('es-value-fixtures'); - -test('isCodePoint', function (t) { - forEach(v.notNonNegativeIntegers.concat(0x10FFFF + 1), function (nonCodePoints) { - t.equal(isCodePoint(nonCodePoints), false, debug(nonCodePoints) + ' is not a Code Point'); - }); - - forEach([-0, 0, 1, 7, 42, 0x10FFFF], function (codePoint) { - t.equal(isCodePoint(codePoint), true, debug(codePoint) + ' is a Code Point'); - }); - - t.end(); -}); diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/runManifestTest.js b/docs/snippets/node_modules/es-abstract/test/helpers/runManifestTest.js deleted file mode 100644 index 2fdb4f21..00000000 --- a/docs/snippets/node_modules/es-abstract/test/helpers/runManifestTest.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -var path = require('path'); -var fs = require('fs'); - -var forEach = require('foreach'); -var keys = require('object-keys'); - -module.exports = function runManifestTest(test, ES, edition) { - test('ES' + edition + ' manifest', { skip: !fs.readdirSync }, function (t) { - var files = fs.readdirSync(path.join(__dirname, '../../' + edition), 'utf-8'); - var map = { - AbstractEqualityComparison: 'Abstract Equality Comparison', - AbstractRelationalComparison: 'Abstract Relational Comparison', - StrictEqualityComparison: 'Strict Equality Comparison' - }; - forEach(files, function (file) { - var name = path.basename(file, path.extname(file)); - var actual = ES[map[name] || name]; - var expected = require(path.join(__dirname, '../../' + edition + '/', file)); // eslint-disable-line global-require - t.equal(actual, expected, 'ES["' + name + '"] === ' + file); - }); - var actualCount = keys(ES).length; - t.equal(actualCount, files.length, 'expected ' + files.length + ' files, got ' + actualCount); - t.end(); - }); -}; diff --git a/docs/snippets/node_modules/es-abstract/test/index.js b/docs/snippets/node_modules/es-abstract/test/index.js deleted file mode 100644 index 5ebe3dbc..00000000 --- a/docs/snippets/node_modules/es-abstract/test/index.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; - -var ES = require('../'); -var test = require('tape'); -var keys = require('object-keys'); -var forEach = require('foreach'); - -var ESkeys = keys(ES).sort(); -var ES6keys = keys(ES.ES6).sort(); - -test('exposed properties', function (t) { - t.deepEqual(ESkeys, ES6keys.concat(['ES2020', 'ES2019', 'ES2018', 'ES2017', 'ES7', 'ES2016', 'ES6', 'ES2015', 'ES5']).sort(), 'main ES object keys match ES6 keys'); - t.end(); -}); - -test('methods match', function (t) { - forEach(ES6keys, function (key) { - t.equal(ES.ES6[key], ES[key], 'method ' + key + ' on main ES object is ES6 method'); - }); - t.end(); -}); - -require('./GetIntrinsic'); - -require('./helpers'); - -require('./es5'); -require('./es6'); -require('./es2015'); -require('./es7'); -require('./es2016'); -require('./es2017'); -require('./es2018'); -require('./es2019'); -require('./es2020'); diff --git a/docs/snippets/node_modules/es-abstract/test/ses-compat.js b/docs/snippets/node_modules/es-abstract/test/ses-compat.js deleted file mode 100644 index c3e60f4a..00000000 --- a/docs/snippets/node_modules/es-abstract/test/ses-compat.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -/* globals lockdown */ -require('ses'); - -lockdown({ errorTaming: 'unsafe' }); - -require('.'); diff --git a/docs/snippets/node_modules/es-abstract/test/tests.js b/docs/snippets/node_modules/es-abstract/test/tests.js deleted file mode 100644 index e3ec4003..00000000 --- a/docs/snippets/node_modules/es-abstract/test/tests.js +++ /dev/null @@ -1,6962 +0,0 @@ -'use strict'; - -var tape = require('tape'); - -var forEach = require('foreach'); -var debug = require('object-inspect'); -var assign = require('object.assign'); -var keys = require('object-keys'); -var has = require('has'); -var arrowFns = require('make-arrow-function').list(); -var hasStrictMode = require('has-strict-mode')(); -var functionsHaveNames = require('functions-have-names')(); -var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames(); -var hasBigInts = require('has-bigints')(); - -var $getProto = require('../helpers/getProto'); -var $setProto = require('../helpers/setProto'); -var defineProperty = require('./helpers/defineProperty'); -var getInferredName = require('../helpers/getInferredName'); -var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor'); -var assertRecordTests = require('./helpers/assertRecord'); -var v = require('es-value-fixtures'); -var diffOps = require('./diffOps'); - -var $BigInt = hasBigInts ? BigInt : null; - -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1; - -var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false - -// IE 9 does not throw in strict mode when writability/configurability/extensibility is violated -var noThrowOnStrictViolation = (function () { - try { - delete [].length; - return true; - } catch (e) { - } - return false; -}()); - -var makeTest = function makeTest(skips) { - return function test(opName, maybeOpts, maybeCb) { - var origOpts = arguments.length > 2 ? maybeOpts : {}; - var opts = assign( - {}, - origOpts, - { skip: (skips && skips[opName]) || origOpts.skip } - ); - var cb = arguments.length > 2 ? maybeCb : maybeOpts; - return tape(opName, opts, cb); - }; -}; - -var leadingPoo = '\uD83D'; -var trailingPoo = '\uDCA9'; -var wholePoo = leadingPoo + trailingPoo; - -var getArraySubclassWithSpeciesConstructor = function getArraySubclass(speciesConstructor) { - var Bar = function Bar() { - var inst = []; - Object.setPrototypeOf(inst, Bar.prototype); - defineProperty(inst, 'constructor', { value: Bar }); - return inst; - }; - Bar.prototype = Object.create(Array.prototype); - Object.setPrototypeOf(Bar, Array); - defineProperty(Bar, Symbol.species, { value: speciesConstructor }); - - return Bar; -}; - -var testIterator = function (t, iterator, expected) { - var resultCount = 0; - var result; - while (result = iterator.next(), !result.done) { // eslint-disable-line no-sequences - t.deepEqual(result, { done: false, value: expected[resultCount] }, 'result ' + resultCount); - resultCount += 1; - } - t.equal(resultCount, expected.length, 'expected ' + expected.length + ', got ' + resultCount); -}; - -var hasSpecies = v.hasSymbols && Symbol.species; - -var hasLastIndex = 'lastIndex' in (/a/).exec('a'); // IE 8 -var hasGroups = 'groups' in (/a/).exec('a'); // modern engines -var kludgeMatch = function kludgeMatch(R, matchObject) { - if (hasGroups) { - assign(matchObject, { groups: matchObject.groups }); - } - if (hasLastIndex) { - assign(matchObject, { lastIndex: R.lastIndex }); - } - return matchObject; -}; - -var testEnumerableOwnNames = function (t, enumerableOwnNames) { - forEach(v.primitives, function (nonObject) { - t['throws']( - function () { enumerableOwnNames(nonObject); }, - debug(nonObject) + ' is not an Object' - ); - }); - - var Child = function Child() { - this.own = {}; - }; - Child.prototype = { - inherited: {} - }; - - var obj = new Child(); - - t.equal('own' in obj, true, 'has "own"'); - t.equal(has(obj, 'own'), true, 'has own "own"'); - t.equal(Object.prototype.propertyIsEnumerable.call(obj, 'own'), true, 'has enumerable "own"'); - - t.equal('inherited' in obj, true, 'has "inherited"'); - t.equal(has(obj, 'inherited'), false, 'has non-own "inherited"'); - t.equal(has(Child.prototype, 'inherited'), true, 'Child.prototype has own "inherited"'); - t.equal(Child.prototype.inherited, obj.inherited, 'Child.prototype.inherited === obj.inherited'); - t.equal(Object.prototype.propertyIsEnumerable.call(Child.prototype, 'inherited'), true, 'has enumerable "inherited"'); - - t.equal('toString' in obj, true, 'has "toString"'); - t.equal(has(obj, 'toString'), false, 'has non-own "toString"'); - t.equal(has(Object.prototype, 'toString'), true, 'Object.prototype has own "toString"'); - t.equal(Object.prototype.toString, obj.toString, 'Object.prototype.toString === obj.toString'); - // eslint-disable-next-line no-useless-call - t.equal(Object.prototype.propertyIsEnumerable.call(Object.prototype, 'toString'), false, 'has non-enumerable "toString"'); - - return obj; -}; - -var testToNumber = function (t, ES, ToNumber) { - t.equal(NaN, ToNumber(undefined), 'undefined coerces to NaN'); - t.equal(ToNumber(null), 0, 'null coerces to +0'); - t.equal(ToNumber(false), 0, 'false coerces to +0'); - t.equal(1, ToNumber(true), 'true coerces to 1'); - - t.test('numbers', function (st) { - st.equal(NaN, ToNumber(NaN), 'NaN returns itself'); - forEach(v.zeroes.concat(v.infinities, 42), function (num) { - st.equal(num, ToNumber(num), num + ' returns itself'); - }); - forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) { - st.equal(+numString, ToNumber(numString), '"' + numString + '" coerces to ' + Number(numString)); - }); - st.end(); - }); - - t.test('objects', function (st) { - forEach(v.objects, function (object) { - st.equal(ToNumber(object), ToNumber(ES.ToPrimitive(object)), 'object ' + object + ' coerces to same as ToPrimitive of object does'); - }); - st['throws'](function () { return ToNumber(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - st.end(); - }); - - // TODO: check if this applies to ES5 - t.test('binary literals', function (st) { - st.equal(ToNumber('0b10'), 2, '0b10 is 2'); - st.equal(ToNumber({ toString: function () { return '0b11'; } }), 3, 'Object that toStrings to 0b11 is 3'); - - st.equal(ToNumber('0b12'), NaN, '0b12 is NaN'); - st.equal(ToNumber({ toString: function () { return '0b112'; } }), NaN, 'Object that toStrings to 0b112 is NaN'); - st.end(); - }); - - // TODO: check if this applies to ES5 - t.test('octal literals', function (st) { - st.equal(ToNumber('0o10'), 8, '0o10 is 8'); - st.equal(ToNumber({ toString: function () { return '0o11'; } }), 9, 'Object that toStrings to 0o11 is 9'); - - st.equal(ToNumber('0o18'), NaN, '0o18 is NaN'); - st.equal(ToNumber({ toString: function () { return '0o118'; } }), NaN, 'Object that toStrings to 0o118 is NaN'); - st.end(); - }); - - // TODO: check if this applies to ES5 - t.test('signed hex numbers', function (st) { - st.equal(ToNumber('-0xF'), NaN, '-0xF is NaN'); - st.equal(ToNumber(' -0xF '), NaN, 'space-padded -0xF is NaN'); - st.equal(ToNumber('+0xF'), NaN, '+0xF is NaN'); - st.equal(ToNumber(' +0xF '), NaN, 'space-padded +0xF is NaN'); - - st.end(); - }); - - // TODO: check if this applies to ES5 - t.test('trimming of whitespace and non-whitespace characters', function (st) { - var whitespace = ' \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; - st.equal(0, ToNumber(whitespace + 0 + whitespace), 'whitespace is trimmed'); - - // Zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace. - var nonWhitespaces = { - '\\u0085': '\u0085', - '\\u200b': '\u200b', - '\\ufffe': '\ufffe' - }; - - forEach(nonWhitespaces, function (desc, nonWS) { - st.equal(ToNumber(nonWS + 0 + nonWS), NaN, 'non-whitespace ' + desc + ' not trimmed'); - }); - - st.end(); - }); - - // TODO: skip for ES5 - forEach(v.symbols, function (symbol) { - t['throws']( - function () { ToNumber(symbol); }, - TypeError, - 'Symbols can’t be converted to a Number: ' + debug(symbol) - ); - - var boxed = Object(symbol); - t['throws']( - function () { ToNumber(boxed); }, - TypeError, - 'boxed Symbols can’t be converted to a Number: ' + debug(boxed) - ); - }); - - // TODO: check if this applies to ES5 - t.test('dates', function (st) { - var invalid = new Date(NaN); - st.equal(ToNumber(invalid), NaN, 'invalid Date coerces to NaN'); - var now = +new Date(); - st.equal(ToNumber(new Date(now)), now, 'Date coerces to timestamp'); - st.end(); - }); -}; - -var es5 = function ES5(ES, ops, expectedMissing, skips) { - var test = makeTest(skips); - - test('has expected operations', function (t) { - var diff = diffOps(ES, ops, expectedMissing); - - t.deepEqual(diff.extra, [], 'no extra ops'); - - t.deepEqual(diff.missing, [], 'no unexpected missing ops'); - - t.deepEqual(diff.extraMissing, [], 'no unexpected "expected missing" ops'); - - t.end(); - }); - - test('ToPrimitive', function (t) { - t.test('primitives', function (st) { - var testPrimitive = function (primitive) { - st.equal(ES.ToPrimitive(primitive), primitive, debug(primitive) + ' is returned correctly'); - }; - forEach(v.primitives, testPrimitive); - st.end(); - }); - - t.test('objects', function (st) { - st.equal(ES.ToPrimitive(v.coercibleObject), 3, 'coercibleObject with no hint coerces to valueOf'); - st.equal(ES.ToPrimitive({}), '[object Object]', '{} with no hint coerces to Object#toString'); - st.equal(ES.ToPrimitive(v.coercibleObject, Number), 3, 'coercibleObject with hint Number coerces to valueOf'); - st.equal(ES.ToPrimitive({}, Number), '[object Object]', '{} with hint Number coerces to NaN'); - st.equal(ES.ToPrimitive(v.coercibleObject, String), 42, 'coercibleObject with hint String coerces to nonstringified toString'); - st.equal(ES.ToPrimitive({}, String), '[object Object]', '{} with hint String coerces to Object#toString'); - st.equal(ES.ToPrimitive(v.coercibleFnObject), v.coercibleFnObject.toString(), 'coercibleFnObject coerces to toString'); - st.equal(ES.ToPrimitive(v.toStringOnlyObject), 7, 'toStringOnlyObject returns non-stringified toString'); - st.equal(ES.ToPrimitive(v.valueOfOnlyObject), 4, 'valueOfOnlyObject returns valueOf'); - st['throws'](function () { return ES.ToPrimitive(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); - st['throws'](function () { return ES.ToPrimitive(v.uncoercibleFnObject); }, TypeError, 'uncoercibleFnObject throws a TypeError'); - st.end(); - }); - - t.test('dates', function (st) { - var invalid = new Date(NaN); - st.equal(ES.ToPrimitive(invalid), Date.prototype.toString.call(invalid), 'invalid Date coerces to Date#toString'); - var now = new Date(); - st.equal(ES.ToPrimitive(now), Date.prototype.toString.call(now), 'Date coerces to Date#toString'); - st.end(); - }); - - t.end(); - }); - - test('ToBoolean', function (t) { - t.equal(false, ES.ToBoolean(undefined), 'undefined coerces to false'); - t.equal(false, ES.ToBoolean(null), 'null coerces to false'); - t.equal(false, ES.ToBoolean(false), 'false returns false'); - t.equal(true, ES.ToBoolean(true), 'true returns true'); - - t.test('numbers', function (st) { - forEach(v.zeroes.concat(NaN), function (falsyNumber) { - st.equal(false, ES.ToBoolean(falsyNumber), 'falsy number ' + falsyNumber + ' coerces to false'); - }); - forEach(v.infinities.concat([42, 1]), function (truthyNumber) { - st.equal(true, ES.ToBoolean(truthyNumber), 'truthy number ' + truthyNumber + ' coerces to true'); - }); - - st.end(); - }); - - t.equal(false, ES.ToBoolean(''), 'empty string coerces to false'); - t.equal(true, ES.ToBoolean('foo'), 'nonempty string coerces to true'); - - t.test('objects', function (st) { - forEach(v.objects, function (obj) { - st.equal(true, ES.ToBoolean(obj), 'object coerces to true'); - }); - st.equal(true, ES.ToBoolean(v.uncoercibleObject), 'uncoercibleObject coerces to true'); - - st.end(); - }); - - t.end(); - }); - - test('ToNumber', function (t) { - t.equal(NaN, ES.ToNumber(undefined), 'undefined coerces to NaN'); - t.equal(ES.ToNumber(null), 0, 'null coerces to +0'); - t.equal(ES.ToNumber(false), 0, 'false coerces to +0'); - t.equal(1, ES.ToNumber(true), 'true coerces to 1'); - - t.test('numbers', function (st) { - st.equal(NaN, ES.ToNumber(NaN), 'NaN returns itself'); - forEach(v.zeroes.concat(v.infinities, 42), function (num) { - st.equal(num, ES.ToNumber(num), num + ' returns itself'); - }); - forEach(['foo', '0', '4a', '2.0', 'Infinity', '-Infinity'], function (numString) { - st.equal(+numString, ES.ToNumber(numString), '"' + numString + '" coerces to ' + Number(numString)); - }); - st.end(); - }); - - t.test('objects', function (st) { - forEach(v.objects, function (object) { - st.equal(ES.ToNumber(object), ES.ToNumber(ES.ToPrimitive(object)), 'object ' + object + ' coerces to same as ToPrimitive of object does'); - }); - st['throws'](function () { return ES.ToNumber(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - st.end(); - }); - - t.test('binary literals', function (st) { - st.equal(ES.ToNumber('0b10'), NaN, '0b10 is NaN'); - st.equal(ES.ToNumber({ toString: function () { return '0b11'; } }), NaN, 'Object that toStrings to 0b11 is NaN'); - - st.equal(ES.ToNumber('0b12'), NaN, '0b12 is NaN'); - st.equal(ES.ToNumber({ toString: function () { return '0b112'; } }), NaN, 'Object that toStrings to 0b112 is NaN'); - st.end(); - }); - - t.test('octal literals', function (st) { - st.equal(ES.ToNumber('0o10'), NaN, '0o10 is NaN'); - st.equal(ES.ToNumber({ toString: function () { return '0o11'; } }), NaN, 'Object that toStrings to 0o11 is NaN'); - - st.equal(ES.ToNumber('0o18'), NaN, '0o18 is NaN'); - st.equal(ES.ToNumber({ toString: function () { return '0o118'; } }), NaN, 'Object that toStrings to 0o118 is NaN'); - st.end(); - }); - - t.test('signed hex numbers', function (st) { - st.equal(ES.ToNumber('-0xF'), NaN, '-0xF is NaN'); - st.equal(ES.ToNumber(' -0xF '), NaN, 'space-padded -0xF is NaN'); - st.equal(ES.ToNumber('+0xF'), NaN, '+0xF is NaN'); - st.equal(ES.ToNumber(' +0xF '), NaN, 'space-padded +0xF is NaN'); - - st.end(); - }); - - // TODO: check if this applies to ES5 - t.test('trimming of whitespace and non-whitespace characters', function (st) { - var whitespace = ' \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085'; - st.equal(ES.ToNumber(whitespace + 0 + whitespace), 0, 'whitespace is trimmed'); - - // Zero-width space (zws), next line character (nel), and non-character (bom) are not whitespace. - var nonWhitespaces = { - '\\u200b': '\u200b', - '\\ufffe': '\ufffe' - }; - - forEach(nonWhitespaces, function (desc, nonWS) { - st.equal(ES.ToNumber(nonWS + 0 + nonWS), NaN, 'non-whitespace ' + desc + ' not trimmed'); - }); - - st.end(); - }); - - t.test('dates', function (st) { - var invalid = new Date(NaN); - st.equal(ES.ToNumber(invalid), NaN, 'invalid Date coerces to NaN'); - var now = +new Date(); - st.equal(ES.ToNumber(new Date(now)), now, 'Date coerces to timestamp'); - st.end(); - }); - - t.end(); - }); - - test('ToInteger', function (t) { - forEach([NaN], function (num) { - t.equal(0, ES.ToInteger(num), debug(num) + ' returns +0'); - }); - forEach(v.zeroes.concat(v.infinities, 42), function (num) { - t.equal(num, ES.ToInteger(num), debug(num) + ' returns itself'); - t.equal(-num, ES.ToInteger(-num), '-' + debug(num) + ' returns itself'); - }); - t.equal(3, ES.ToInteger(Math.PI), 'pi returns 3'); - t['throws'](function () { return ES.ToInteger(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.end(); - }); - - test('ToInt32', function (t) { - t.equal(ES.ToInt32(NaN), 0, 'NaN coerces to +0'); - forEach(v.zeroes.concat(v.infinities), function (num) { - t.equal(ES.ToInt32(num), 0, num + ' returns +0'); - t.equal(ES.ToInt32(-num), 0, '-' + num + ' returns +0'); - }); - t['throws'](function () { return ES.ToInt32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.equal(ES.ToInt32(0x100000000), 0, '2^32 returns +0'); - t.equal(ES.ToInt32(0x100000000 - 1), -1, '2^32 - 1 returns -1'); - t.equal(ES.ToInt32(0x80000000), -0x80000000, '2^31 returns -2^31'); - t.equal(ES.ToInt32(0x80000000 - 1), 0x80000000 - 1, '2^31 - 1 returns 2^31 - 1'); - forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { - t.equal(ES.ToInt32(num), ES.ToInt32(ES.ToUint32(num)), 'ToInt32(x) === ToInt32(ToUint32(x)) for 0x' + num.toString(16)); - t.equal(ES.ToInt32(-num), ES.ToInt32(ES.ToUint32(-num)), 'ToInt32(x) === ToInt32(ToUint32(x)) for -0x' + num.toString(16)); - }); - t.end(); - }); - - test('ToUint32', function (t) { - t.equal(0, ES.ToUint32(NaN), 'NaN coerces to +0'); - forEach([0, Infinity], function (num) { - t.equal(0, ES.ToUint32(num), num + ' returns +0'); - t.equal(0, ES.ToUint32(-num), '-' + num + ' returns +0'); - }); - t['throws'](function () { return ES.ToUint32(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.equal(ES.ToUint32(0x100000000), 0, '2^32 returns +0'); - t.equal(ES.ToUint32(0x100000000 - 1), 0x100000000 - 1, '2^32 - 1 returns 2^32 - 1'); - t.equal(ES.ToUint32(0x80000000), 0x80000000, '2^31 returns 2^31'); - t.equal(ES.ToUint32(0x80000000 - 1), 0x80000000 - 1, '2^31 - 1 returns 2^31 - 1'); - forEach([0, Infinity, NaN, 0x100000000, 0x80000000, 0x10000, 0x42], function (num) { - t.equal(ES.ToUint32(num), ES.ToUint32(ES.ToInt32(num)), 'ToUint32(x) === ToUint32(ToInt32(x)) for 0x' + num.toString(16)); - t.equal(ES.ToUint32(-num), ES.ToUint32(ES.ToInt32(-num)), 'ToUint32(x) === ToUint32(ToInt32(x)) for -0x' + num.toString(16)); - }); - t.end(); - }); - - test('ToUint16', function (t) { - t.equal(0, ES.ToUint16(NaN), 'NaN coerces to +0'); - forEach([0, Infinity], function (num) { - t.equal(0, ES.ToUint16(num), num + ' returns +0'); - t.equal(0, ES.ToUint16(-num), '-' + num + ' returns +0'); - }); - t['throws'](function () { return ES.ToUint16(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.equal(ES.ToUint16(0x100000000), 0, '2^32 returns +0'); - t.equal(ES.ToUint16(0x100000000 - 1), 0x10000 - 1, '2^32 - 1 returns 2^16 - 1'); - t.equal(ES.ToUint16(0x80000000), 0, '2^31 returns +0'); - t.equal(ES.ToUint16(0x80000000 - 1), 0x10000 - 1, '2^31 - 1 returns 2^16 - 1'); - t.equal(ES.ToUint16(0x10000), 0, '2^16 returns +0'); - t.equal(ES.ToUint16(0x10000 - 1), 0x10000 - 1, '2^16 - 1 returns 2^16 - 1'); - t.end(); - }); - - test('ToString', function (t) { - forEach(v.objects.concat(v.nonSymbolPrimitives), function (item) { - t.equal(ES.ToString(item), String(item), 'ES.ToString(' + debug(item) + ') ToStrings to String(' + debug(item) + ')'); - }); - - t['throws'](function () { return ES.ToString(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - - t.end(); - }); - - test('ToObject', function (t) { - t['throws'](function () { return ES.ToObject(undefined); }, TypeError, 'undefined throws'); - t['throws'](function () { return ES.ToObject(null); }, TypeError, 'null throws'); - forEach(v.numbers, function (number) { - var obj = ES.ToObject(number); - t.equal(typeof obj, 'object', 'number ' + number + ' coerces to object'); - t.equal(true, obj instanceof Number, 'object of ' + number + ' is Number object'); - t.equal(obj.valueOf(), number, 'object of ' + number + ' coerces to ' + number); - }); - t.end(); - }); - - test('CheckObjectCoercible', function (t) { - t['throws'](function () { return ES.CheckObjectCoercible(undefined); }, TypeError, 'undefined throws'); - t['throws'](function () { return ES.CheckObjectCoercible(null); }, TypeError, 'null throws'); - var checkCoercible = function (value) { - t.doesNotThrow(function () { return ES.CheckObjectCoercible(value); }, debug(value) + ' does not throw'); - }; - forEach(v.objects.concat(v.nonNullPrimitives), checkCoercible); - t.end(); - }); - - test('IsCallable', function (t) { - t.equal(true, ES.IsCallable(function () {}), 'function is callable'); - var nonCallables = [/a/g, {}, Object.prototype, NaN].concat(v.nonFunctions); - forEach(nonCallables, function (nonCallable) { - t.equal(false, ES.IsCallable(nonCallable), debug(nonCallable) + ' is not callable'); - }); - t.end(); - }); - - test('SameValue', function (t) { - t.equal(true, ES.SameValue(NaN, NaN), 'NaN is SameValue as NaN'); - t.equal(false, ES.SameValue(0, -0), '+0 is not SameValue as -0'); - forEach(v.objects.concat(v.primitives), function (val) { - t.equal(val === val, ES.SameValue(val, val), debug(val) + ' is SameValue to itself'); - }); - t.end(); - }); - - test('Type', function (t) { - t.equal(ES.Type(), 'Undefined', 'Type() is Undefined'); - t.equal(ES.Type(undefined), 'Undefined', 'Type(undefined) is Undefined'); - t.equal(ES.Type(null), 'Null', 'Type(null) is Null'); - t.equal(ES.Type(true), 'Boolean', 'Type(true) is Boolean'); - t.equal(ES.Type(false), 'Boolean', 'Type(false) is Boolean'); - t.equal(ES.Type(0), 'Number', 'Type(0) is Number'); - t.equal(ES.Type(NaN), 'Number', 'Type(NaN) is Number'); - t.equal(ES.Type('abc'), 'String', 'Type("abc") is String'); - t.equal(ES.Type(function () {}), 'Object', 'Type(function () {}) is Object'); - t.equal(ES.Type({}), 'Object', 'Type({}) is Object'); - - t.end(); - }); - - assertRecordTests(ES, test); - - test('IsAccessorDescriptor', function (t) { - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { ES.IsAccessorDescriptor(primitive); }, - TypeError, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - t.equal(ES.IsAccessorDescriptor(), false, 'no value is not an Accessor Descriptor'); - t.equal(ES.IsAccessorDescriptor(undefined), false, 'undefined value is not an Accessor Descriptor'); - - t.equal(ES.IsAccessorDescriptor(v.accessorDescriptor()), true, 'accessor descriptor is an Accessor Descriptor'); - t.equal(ES.IsAccessorDescriptor(v.mutatorDescriptor()), true, 'mutator descriptor is an Accessor Descriptor'); - t.equal(ES.IsAccessorDescriptor(v.dataDescriptor()), false, 'data descriptor is not an Accessor Descriptor'); - t.equal(ES.IsAccessorDescriptor(v.genericDescriptor()), false, 'generic descriptor is not an Accessor Descriptor'); - - t.end(); - }); - - test('IsDataDescriptor', function (t) { - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { ES.IsDataDescriptor(primitive); }, - TypeError, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - t.equal(ES.IsDataDescriptor(), false, 'no value is not a Data Descriptor'); - t.equal(ES.IsDataDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); - - t.equal(ES.IsDataDescriptor(v.accessorDescriptor()), false, 'accessor descriptor is not a Data Descriptor'); - t.equal(ES.IsDataDescriptor(v.mutatorDescriptor()), false, 'mutator descriptor is not a Data Descriptor'); - t.equal(ES.IsDataDescriptor(v.dataDescriptor()), true, 'data descriptor is a Data Descriptor'); - t.equal(ES.IsDataDescriptor(v.genericDescriptor()), false, 'generic descriptor is not a Data Descriptor'); - - t.end(); - }); - - test('IsGenericDescriptor', function (t) { - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { ES.IsGenericDescriptor(primitive); }, - TypeError, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - t.equal(ES.IsGenericDescriptor(), false, 'no value is not a Data Descriptor'); - t.equal(ES.IsGenericDescriptor(undefined), false, 'undefined value is not a Data Descriptor'); - - t.equal(ES.IsGenericDescriptor(v.accessorDescriptor()), false, 'accessor descriptor is not a generic Descriptor'); - t.equal(ES.IsGenericDescriptor(v.mutatorDescriptor()), false, 'mutator descriptor is not a generic Descriptor'); - t.equal(ES.IsGenericDescriptor(v.dataDescriptor()), false, 'data descriptor is not a generic Descriptor'); - - t.equal(ES.IsGenericDescriptor(v.genericDescriptor()), true, 'generic descriptor is a generic Descriptor'); - - t.end(); - }); - - test('FromPropertyDescriptor', function (t) { - t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined'); - t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined'); - - forEach(v.nonNullPrimitives.concat(null), function (primitive) { - t['throws']( - function () { ES.FromPropertyDescriptor(primitive); }, - TypeError, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - var accessor = v.accessorDescriptor(); - t.deepEqual(ES.FromPropertyDescriptor(accessor), { - get: accessor['[[Get]]'], - set: accessor['[[Set]]'], - enumerable: !!accessor['[[Enumerable]]'], - configurable: !!accessor['[[Configurable]]'] - }); - - var mutator = v.mutatorDescriptor(); - t.deepEqual(ES.FromPropertyDescriptor(mutator), { - get: mutator['[[Get]]'], - set: mutator['[[Set]]'], - enumerable: !!mutator['[[Enumerable]]'], - configurable: !!mutator['[[Configurable]]'] - }); - var data = v.dataDescriptor(); - t.deepEqual(ES.FromPropertyDescriptor(data), { - value: data['[[Value]]'], - writable: data['[[Writable]]'], - enumerable: !!data['[[Enumerable]]'], - configurable: !!data['[[Configurable]]'] - }); - - t['throws']( - function () { ES.FromPropertyDescriptor(v.genericDescriptor()); }, - TypeError, - 'a complete Property Descriptor is required' - ); - - t.end(); - }); - - test('ToPropertyDescriptor', function (t) { - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { ES.ToPropertyDescriptor(primitive); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - - var accessor = v.accessorDescriptor(); - t.deepEqual(ES.ToPropertyDescriptor({ - get: accessor['[[Get]]'], - enumerable: !!accessor['[[Enumerable]]'], - configurable: !!accessor['[[Configurable]]'] - }), accessor); - - var mutator = v.mutatorDescriptor(); - t.deepEqual(ES.ToPropertyDescriptor({ - set: mutator['[[Set]]'], - enumerable: !!mutator['[[Enumerable]]'], - configurable: !!mutator['[[Configurable]]'] - }), mutator); - - var data = v.descriptors.nonConfigurable(v.dataDescriptor()); - t.deepEqual(ES.ToPropertyDescriptor({ - value: data['[[Value]]'], - writable: data['[[Writable]]'], - configurable: !!data['[[Configurable]]'] - }), data); - - var both = v.bothDescriptor(); - t['throws']( - function () { - ES.ToPropertyDescriptor({ get: both['[[Get]]'], value: both['[[Value]]'] }); - }, - TypeError, - 'data and accessor descriptors are mutually exclusive' - ); - - t['throws']( - function () { ES.ToPropertyDescriptor({ get: 'not callable' }); }, - TypeError, - '"get" must be undefined or callable' - ); - - t['throws']( - function () { ES.ToPropertyDescriptor({ set: 'not callable' }); }, - TypeError, - '"set" must be undefined or callable' - ); - - forEach(v.nonFunctions, function (nonFunction) { - if (typeof nonFunction !== 'undefined') { - t['throws']( - function () { ES.ToPropertyDescriptor({ get: nonFunction }); }, - TypeError, - '`.get` has ' + debug(nonFunction) + ', which is not a Function' - ); - t['throws']( - function () { ES.ToPropertyDescriptor({ set: nonFunction }); }, - TypeError, - '`.set` has ' + debug(nonFunction) + ', which is not a Function' - ); - } - }); - - forEach(['get', 'set'], function (accessorName) { - forEach(['value', 'writable'], function (dataName) { - var o = {}; - o[accessorName] = undefined; - o[dataName] = undefined; - - t['throws']( - function () { ES.ToPropertyDescriptor(o); }, - TypeError, - accessorName + ' + ' + dataName + ' is invalid' - ); - }); - }); - - t.end(); - }); - - test('Abstract Equality Comparison', function (t) { - t.test('same types use ===', function (st) { - forEach(v.primitives.concat(v.objects), function (value) { - st.equal(ES['Abstract Equality Comparison'](value, value), value === value, debug(value) + ' is abstractly equal to itself'); - }); - st.end(); - }); - - t.test('different types coerce', function (st) { - var pairs = [ - [null, undefined], - [3, '3'], - [true, '3'], - [true, 3], - [false, 0], - [false, '0'], - [3, [3]], - ['3', [3]], - [true, [1]], - [false, [0]], - [String(v.coercibleObject), v.coercibleObject], - [Number(String(v.coercibleObject)), v.coercibleObject], - [Number(v.coercibleObject), v.coercibleObject], - [String(Number(v.coercibleObject)), v.coercibleObject] - ]; - forEach(pairs, function (pair) { - var a = pair[0]; - var b = pair[1]; - // eslint-disable-next-line eqeqeq - st.equal(ES['Abstract Equality Comparison'](a, b), a == b, debug(a) + ' == ' + debug(b)); - // eslint-disable-next-line eqeqeq - st.equal(ES['Abstract Equality Comparison'](b, a), b == a, debug(b) + ' == ' + debug(a)); - }); - st.end(); - }); - - t.end(); - }); - - test('Strict Equality Comparison', function (t) { - t.test('same types use ===', function (st) { - forEach(v.primitives.concat(v.objects), function (value) { - st.equal(ES['Strict Equality Comparison'](value, value), value === value, debug(value) + ' is strictly equal to itself'); - }); - st.end(); - }); - - t.test('different types are not ===', function (st) { - var pairs = [ - [null, undefined], - [3, '3'], - [true, '3'], - [true, 3], - [false, 0], - [false, '0'], - [3, [3]], - ['3', [3]], - [true, [1]], - [false, [0]], - [String(v.coercibleObject), v.coercibleObject], - [Number(String(v.coercibleObject)), v.coercibleObject], - [Number(v.coercibleObject), v.coercibleObject], - [String(Number(v.coercibleObject)), v.coercibleObject] - ]; - forEach(pairs, function (pair) { - var a = pair[0]; - var b = pair[1]; - st.equal(ES['Strict Equality Comparison'](a, b), a === b, debug(a) + ' === ' + debug(b)); - st.equal(ES['Strict Equality Comparison'](b, a), b === a, debug(b) + ' === ' + debug(a)); - }); - st.end(); - }); - - t.end(); - }); - - test('Abstract Relational Comparison', function (t) { - t.test('at least one operand is NaN', function (st) { - st.equal(ES['Abstract Relational Comparison'](NaN, {}, true), undefined, 'LeftFirst: first is NaN, returns undefined'); - st.equal(ES['Abstract Relational Comparison']({}, NaN, true), undefined, 'LeftFirst: second is NaN, returns undefined'); - st.equal(ES['Abstract Relational Comparison'](NaN, {}, false), undefined, '!LeftFirst: first is NaN, returns undefined'); - st.equal(ES['Abstract Relational Comparison']({}, NaN, false), undefined, '!LeftFirst: second is NaN, returns undefined'); - st.end(); - }); - - forEach(v.nonBooleans, function (nonBoolean) { - t['throws']( - function () { ES['Abstract Relational Comparison'](3, 4, nonBoolean); }, - TypeError, - debug(nonBoolean) + ' is not a Boolean' - ); - }); - - forEach(v.zeroes, function (zero) { - t.equal(ES['Abstract Relational Comparison'](zero, 1, true), true, 'LeftFirst: ' + debug(zero) + ' is less than 1'); - t.equal(ES['Abstract Relational Comparison'](zero, 1, false), true, '!LeftFirst: ' + debug(zero) + ' is less than 1'); - t.equal(ES['Abstract Relational Comparison'](1, zero, true), false, 'LeftFirst: 1 is not less than ' + debug(zero)); - t.equal(ES['Abstract Relational Comparison'](1, zero, false), false, '!LeftFirst: 1 is not less than ' + debug(zero)); - - t.equal(ES['Abstract Relational Comparison'](zero, zero, true), false, 'LeftFirst: ' + debug(zero) + ' is not less than ' + debug(zero)); - t.equal(ES['Abstract Relational Comparison'](zero, zero, false), false, '!LeftFirst: ' + debug(zero) + ' is not less than ' + debug(zero)); - }); - - t.equal(ES['Abstract Relational Comparison'](Infinity, -Infinity, true), false, 'LeftFirst: ∞ is not less than -∞'); - t.equal(ES['Abstract Relational Comparison'](Infinity, -Infinity, false), false, '!LeftFirst: ∞ is not less than -∞'); - t.equal(ES['Abstract Relational Comparison'](-Infinity, Infinity, true), true, 'LeftFirst: -∞ is less than ∞'); - t.equal(ES['Abstract Relational Comparison'](-Infinity, Infinity, false), true, '!LeftFirst: -∞ is less than ∞'); - t.equal(ES['Abstract Relational Comparison'](-Infinity, 0, true), true, 'LeftFirst: -∞ is less than +0'); - t.equal(ES['Abstract Relational Comparison'](-Infinity, 0, false), true, '!LeftFirst: -∞ is less than +0'); - t.equal(ES['Abstract Relational Comparison'](0, -Infinity, true), false, 'LeftFirst: +0 is not less than -∞'); - t.equal(ES['Abstract Relational Comparison'](0, -Infinity, false), false, '!LeftFirst: +0 is not less than -∞'); - - t.equal(ES['Abstract Relational Comparison'](3, 4, true), true, 'LeftFirst: 3 is less than 4'); - t.equal(ES['Abstract Relational Comparison'](4, 3, true), false, 'LeftFirst: 3 is not less than 4'); - t.equal(ES['Abstract Relational Comparison'](3, 4, false), true, '!LeftFirst: 3 is less than 4'); - t.equal(ES['Abstract Relational Comparison'](4, 3, false), false, '!LeftFirst: 3 is not less than 4'); - - t.equal(ES['Abstract Relational Comparison']('3', '4', true), true, 'LeftFirst: "3" is less than "4"'); - t.equal(ES['Abstract Relational Comparison']('4', '3', true), false, 'LeftFirst: "3" is not less than "4"'); - t.equal(ES['Abstract Relational Comparison']('3', '4', false), true, '!LeftFirst: "3" is less than "4"'); - t.equal(ES['Abstract Relational Comparison']('4', '3', false), false, '!LeftFirst: "3" is not less than "4"'); - - t.equal(ES['Abstract Relational Comparison']('a', 'abc', true), true, 'LeftFirst: "a" is less than "abc"'); - t.equal(ES['Abstract Relational Comparison']('abc', 'a', true), false, 'LeftFirst: "abc" is not less than "a"'); - t.equal(ES['Abstract Relational Comparison']('a', 'abc', false), true, '!LeftFirst: "a" is less than "abc"'); - t.equal(ES['Abstract Relational Comparison']('abc', 'a', false), false, '!LeftFirst: "abc" is not less than "a"'); - - t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, 42, true), true, 'LeftFirst: coercible object is less than 42'); - t.equal(ES['Abstract Relational Comparison'](42, v.coercibleObject, true), false, 'LeftFirst: 42 is not less than coercible object'); - t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, 42, false), true, '!LeftFirst: coercible object is less than 42'); - t.equal(ES['Abstract Relational Comparison'](42, v.coercibleObject, false), false, '!LeftFirst: 42 is not less than coercible object'); - - t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, '3', true), false, 'LeftFirst: coercible object is not less than "3"'); - t.equal(ES['Abstract Relational Comparison']('3', v.coercibleObject, true), false, 'LeftFirst: "3" is not less than coercible object'); - t.equal(ES['Abstract Relational Comparison'](v.coercibleObject, '3', false), false, '!LeftFirst: coercible object is not less than "3"'); - t.equal(ES['Abstract Relational Comparison']('3', v.coercibleObject, false), false, '!LeftFirst: "3" is not less than coercible object'); - - t.end(); - }); - - test('SecFromTime', function (t) { - var now = new Date(); - t.equal(ES.SecFromTime(now.getTime()), now.getUTCSeconds(), 'second from Date timestamp matches getUTCSeconds'); - t.end(); - }); - - test('MinFromTime', function (t) { - var now = new Date(); - t.equal(ES.MinFromTime(now.getTime()), now.getUTCMinutes(), 'minute from Date timestamp matches getUTCMinutes'); - t.end(); - }); - - test('HourFromTime', function (t) { - var now = new Date(); - t.equal(ES.HourFromTime(now.getTime()), now.getUTCHours(), 'hour from Date timestamp matches getUTCHours'); - t.end(); - }); - - test('msFromTime', function (t) { - var now = new Date(); - t.equal(ES.msFromTime(now.getTime()), now.getUTCMilliseconds(), 'ms from Date timestamp matches getUTCMilliseconds'); - t.end(); - }); - - var msPerSecond = 1e3; - var msPerMinute = 60 * msPerSecond; - var msPerHour = 60 * msPerMinute; - var msPerDay = 24 * msPerHour; - - test('Day', function (t) { - var time = Date.UTC(2019, 8, 10, 2, 3, 4, 5); - var add = 2.5; - var later = new Date(time + (add * msPerDay)); - - t.equal(ES.Day(later.getTime()), ES.Day(time) + Math.floor(add), 'adding 2.5 days worth of ms, gives a Day delta of 2'); - t.end(); - }); - - test('DayFromYear', function (t) { - t.equal(ES.DayFromYear(2021) - ES.DayFromYear(2020), 366, '2021 is a leap year, has 366 days'); - t.equal(ES.DayFromYear(2020) - ES.DayFromYear(2019), 365, '2020 is not a leap year, has 365 days'); - t.equal(ES.DayFromYear(2019) - ES.DayFromYear(2018), 365, '2019 is not a leap year, has 365 days'); - t.equal(ES.DayFromYear(2018) - ES.DayFromYear(2017), 365, '2018 is not a leap year, has 365 days'); - t.equal(ES.DayFromYear(2017) - ES.DayFromYear(2016), 366, '2017 is a leap year, has 366 days'); - - t.end(); - }); - - test('TimeWithinDay', function (t) { - var time = Date.UTC(2019, 8, 10, 2, 3, 4, 5); - var add = 2.5; - var later = new Date(time + (add * msPerDay)); - - t.equal(ES.TimeWithinDay(later.getTime()), ES.TimeWithinDay(time) + (0.5 * msPerDay), 'adding 2.5 days worth of ms, gives a TimeWithinDay delta of +0.5'); - t.end(); - }); - - test('TimeFromYear', function (t) { - for (var i = 1900; i < 2100; i += 1) { - t.equal(ES.TimeFromYear(i), Date.UTC(i, 0, 1), 'TimeFromYear matches a Date object’s year: ' + i); - } - t.end(); - }); - - test('YearFromTime', function (t) { - for (var i = 1900; i < 2100; i += 1) { - t.equal(ES.YearFromTime(Date.UTC(i, 0, 1)), i, 'YearFromTime matches a Date object’s year on 1/1: ' + i); - t.equal(ES.YearFromTime(Date.UTC(i, 10, 1)), i, 'YearFromTime matches a Date object’s year on 10/1: ' + i); - } - t.end(); - }); - - test('WeekDay', function (t) { - var now = new Date(); - var today = now.getUTCDay(); - for (var i = 0; i < 7; i += 1) { - var weekDay = ES.WeekDay(now.getTime() + (i * msPerDay)); - t.equal(weekDay, (today + i) % 7, i + ' days after today (' + today + '), WeekDay is ' + weekDay); - } - t.end(); - }); - - test('DaysInYear', function (t) { - t.equal(ES.DaysInYear(2021), 365, '2021 is not a leap year'); - t.equal(ES.DaysInYear(2020), 366, '2020 is a leap year'); - t.equal(ES.DaysInYear(2019), 365, '2019 is not a leap year'); - t.equal(ES.DaysInYear(2018), 365, '2018 is not a leap year'); - t.equal(ES.DaysInYear(2017), 365, '2017 is not a leap year'); - t.equal(ES.DaysInYear(2016), 366, '2016 is a leap year'); - t.equal(ES.DaysInYear(2000), 366, '2000 is a leap year'); - t.equal(ES.DaysInYear(1900), 365, '1900 is not a leap year'); - - t.end(); - }); - - test('InLeapYear', function (t) { - t.equal(ES.InLeapYear(Date.UTC(2021, 0, 1)), 0, '2021 is not a leap year'); - t.equal(ES.InLeapYear(Date.UTC(2020, 0, 1)), 1, '2020 is a leap year'); - t.equal(ES.InLeapYear(Date.UTC(2019, 0, 1)), 0, '2019 is not a leap year'); - t.equal(ES.InLeapYear(Date.UTC(2018, 0, 1)), 0, '2018 is not a leap year'); - t.equal(ES.InLeapYear(Date.UTC(2017, 0, 1)), 0, '2017 is not a leap year'); - t.equal(ES.InLeapYear(Date.UTC(2016, 0, 1)), 1, '2016 is a leap year'); - - t.end(); - }); - - test('DayWithinYear', function (t) { - t.equal(ES.DayWithinYear(Date.UTC(2019, 0, 1)), 0, '1/1 is the 1st day'); - t.equal(ES.DayWithinYear(Date.UTC(2019, 11, 31)), 364, '12/31 is the 365th day in a non leap year'); - t.equal(ES.DayWithinYear(Date.UTC(2016, 11, 31)), 365, '12/31 is the 366th day in a leap year'); - - t.end(); - }); - - test('MonthFromTime', function (t) { - t.equal(ES.MonthFromTime(Date.UTC(2019, 0, 1)), 0, 'non-leap: 1/1 gives January'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 0, 31)), 0, 'non-leap: 1/31 gives January'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 1)), 1, 'non-leap: 2/1 gives February'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 28)), 1, 'non-leap: 2/28 gives February'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 1, 29)), 2, 'non-leap: 2/29 gives March'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 2, 1)), 2, 'non-leap: 3/1 gives March'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 2, 31)), 2, 'non-leap: 3/31 gives March'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 3, 1)), 3, 'non-leap: 4/1 gives April'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 3, 30)), 3, 'non-leap: 4/30 gives April'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 4, 1)), 4, 'non-leap: 5/1 gives May'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 4, 31)), 4, 'non-leap: 5/31 gives May'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 5, 1)), 5, 'non-leap: 6/1 gives June'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 5, 30)), 5, 'non-leap: 6/30 gives June'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 6, 1)), 6, 'non-leap: 7/1 gives July'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 6, 31)), 6, 'non-leap: 7/31 gives July'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 7, 1)), 7, 'non-leap: 8/1 gives August'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 7, 30)), 7, 'non-leap: 8/30 gives August'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 8, 1)), 8, 'non-leap: 9/1 gives September'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 8, 30)), 8, 'non-leap: 9/30 gives September'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 9, 1)), 9, 'non-leap: 10/1 gives October'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 9, 31)), 9, 'non-leap: 10/31 gives October'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 10, 1)), 10, 'non-leap: 11/1 gives November'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 10, 30)), 10, 'non-leap: 11/30 gives November'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 11, 1)), 11, 'non-leap: 12/1 gives December'); - t.equal(ES.MonthFromTime(Date.UTC(2019, 11, 31)), 11, 'non-leap: 12/31 gives December'); - - t.equal(ES.MonthFromTime(Date.UTC(2016, 0, 1)), 0, 'leap: 1/1 gives January'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 0, 31)), 0, 'leap: 1/31 gives January'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 1)), 1, 'leap: 2/1 gives February'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 28)), 1, 'leap: 2/28 gives February'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 1, 29)), 1, 'leap: 2/29 gives February'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 2, 1)), 2, 'leap: 3/1 gives March'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 2, 31)), 2, 'leap: 3/31 gives March'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 3, 1)), 3, 'leap: 4/1 gives April'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 3, 30)), 3, 'leap: 4/30 gives April'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 4, 1)), 4, 'leap: 5/1 gives May'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 4, 31)), 4, 'leap: 5/31 gives May'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 5, 1)), 5, 'leap: 6/1 gives June'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 5, 30)), 5, 'leap: 6/30 gives June'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 6, 1)), 6, 'leap: 7/1 gives July'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 6, 31)), 6, 'leap: 7/31 gives July'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 7, 1)), 7, 'leap: 8/1 gives August'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 7, 30)), 7, 'leap: 8/30 gives August'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 8, 1)), 8, 'leap: 9/1 gives September'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 8, 30)), 8, 'leap: 9/30 gives September'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 9, 1)), 9, 'leap: 10/1 gives October'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 9, 31)), 9, 'leap: 10/31 gives October'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 10, 1)), 10, 'leap: 11/1 gives November'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 10, 30)), 10, 'leap: 11/30 gives November'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 11, 1)), 11, 'leap: 12/1 gives December'); - t.equal(ES.MonthFromTime(Date.UTC(2016, 11, 31)), 11, 'leap: 12/31 gives December'); - t.end(); - }); - - test('DateFromTime', function (t) { - var i; - for (i = 1; i <= 28; i += 1) { - t.equal(ES.DateFromTime(Date.UTC(2019, 1, i)), i, '2019.02.' + i + ' is date ' + i); - } - for (i = 1; i <= 29; i += 1) { - t.equal(ES.DateFromTime(Date.UTC(2016, 1, i)), i, '2016.02.' + i + ' is date ' + i); - } - for (i = 1; i <= 30; i += 1) { - t.equal(ES.DateFromTime(Date.UTC(2019, 2, i)), i, '2019.03.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 3, i)), i, '2019.04.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 5, i)), i, '2019.06.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 7, i)), i, '2019.08.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 8, i)), i, '2019.09.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 10, i)), i, '2019.11.' + i + ' is date ' + i); - } - for (i = 1; i <= 31; i += 1) { - t.equal(ES.DateFromTime(Date.UTC(2019, 0, i)), i, '2019.01.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 4, i)), i, '2019.05.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 6, i)), i, '2019.07.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 9, i)), i, '2019.10.' + i + ' is date ' + i); - t.equal(ES.DateFromTime(Date.UTC(2019, 11, i)), i, '2019.12.' + i + ' is date ' + i); - } - t.end(); - }); - - test('MakeDay', function (t) { - forEach([NaN, Infinity, -Infinity], function (nonFiniteNumber) { - t.equal(ES.MakeDay(nonFiniteNumber, 0, 0), NaN, 'year: ' + debug(nonFiniteNumber) + ' is not finite'); - t.equal(ES.MakeDay(0, nonFiniteNumber, 0), NaN, 'month: ' + debug(nonFiniteNumber) + ' is not finite'); - t.equal(ES.MakeDay(0, 0, nonFiniteNumber), NaN, 'date: ' + debug(nonFiniteNumber) + ' is not finite'); - }); - - var day2015 = 16687; - t.equal(ES.MakeDay(2015, 8, 9), day2015, '2015.09.09 is day 16687'); - var day2016 = day2015 + 366; // 2016 is a leap year - t.equal(ES.MakeDay(2016, 8, 9), day2016, '2015.09.09 is day 17053'); - var day2017 = day2016 + 365; - t.equal(ES.MakeDay(2017, 8, 9), day2017, '2017.09.09 is day 17418'); - var day2018 = day2017 + 365; - t.equal(ES.MakeDay(2018, 8, 9), day2018, '2018.09.09 is day 17783'); - var day2019 = day2018 + 365; - t.equal(ES.MakeDay(2019, 8, 9), day2019, '2019.09.09 is day 18148'); - - t.end(); - }); - - test('MakeDate', function (t) { - forEach(v.infinities.concat(NaN), function (nonFiniteNumber) { - t.equal(ES.MakeDate(nonFiniteNumber, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `day`'); - t.equal(ES.MakeDate(0, nonFiniteNumber), NaN, debug(nonFiniteNumber) + ' is not a finite `time`'); - }); - t.equal(ES.MakeDate(0, 0), 0, 'zero day and zero time is zero date'); - t.equal(ES.MakeDate(0, 123), 123, 'zero day and nonzero time is a date of the "time"'); - t.equal(ES.MakeDate(1, 0), msPerDay, 'day of 1 and zero time is a date of "ms per day"'); - t.equal(ES.MakeDate(3, 0), 3 * msPerDay, 'day of 3 and zero time is a date of thrice "ms per day"'); - t.equal(ES.MakeDate(1, 123), msPerDay + 123, 'day of 1 and nonzero time is a date of "ms per day" plus the "time"'); - t.equal(ES.MakeDate(3, 123), (3 * msPerDay) + 123, 'day of 3 and nonzero time is a date of thrice "ms per day" plus the "time"'); - - t.end(); - }); - - test('MakeTime', function (t) { - forEach(v.infinities.concat(NaN), function (nonFiniteNumber) { - t.equal(ES.MakeTime(nonFiniteNumber, 0, 0, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `hour`'); - t.equal(ES.MakeTime(0, nonFiniteNumber, 0, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `min`'); - t.equal(ES.MakeTime(0, 0, nonFiniteNumber, 0), NaN, debug(nonFiniteNumber) + ' is not a finite `sec`'); - t.equal(ES.MakeTime(0, 0, 0, nonFiniteNumber), NaN, debug(nonFiniteNumber) + ' is not a finite `ms`'); - }); - - t.equal( - ES.MakeTime(1.2, 2.3, 3.4, 4.5), - (1 * msPerHour) + (2 * msPerMinute) + (3 * msPerSecond) + 4, - 'all numbers are converted to integer, multiplied by the right number of ms, and summed' - ); - - t.end(); - }); - - test('TimeClip', function (t) { - forEach(v.infinities.concat(NaN), function (nonFiniteNumber) { - t.equal(ES.TimeClip(nonFiniteNumber), NaN, debug(nonFiniteNumber) + ' is not a finite `time`'); - }); - t.equal(ES.TimeClip(8.64e15 + 1), NaN, '8.64e15 is the largest magnitude considered "finite"'); - t.equal(ES.TimeClip(-8.64e15 - 1), NaN, '-8.64e15 is the largest magnitude considered "finite"'); - - forEach(v.zeroes.concat([-10, 10, +new Date()]), function (time) { - t.looseEqual(ES.TimeClip(time), time, debug(time) + ' is a time of ' + debug(time)); - }); - - t.end(); - }); - - test('modulo', function (t) { - t.equal(3 % 2, 1, '+3 % 2 is +1'); - t.equal(ES.modulo(3, 2), 1, '+3 mod 2 is +1'); - - t.equal(-3 % 2, -1, '-3 % 2 is -1'); - t.equal(ES.modulo(-3, 2), 1, '-3 mod 2 is +1'); - t.end(); - }); -}; - -var es2015 = function ES2015(ES, ops, expectedMissing, skips) { - es5(ES, ops, expectedMissing, assign(assign({}, skips), { - CheckObjectCoercible: true, - FromPropertyDescriptor: true, - ToNumber: true, - ToString: true, - Type: true - })); - var test = makeTest(skips); - - var getNamelessFunction = function () { - var f = Object(function () {}); - try { - delete f.name; - } catch (e) { /**/ } - return f; - }; - - test('AdvanceStringIndex', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.AdvanceStringIndex(nonString); }, - TypeError, - '"S" argument must be a String; ' + debug(nonString) + ' is not' - ); - }); - - var notInts = v.nonNumbers.concat( - v.nonIntegerNumbers, - v.infinities, - [NaN, [], new Date(), Math.pow(2, 53), -1] - ); - forEach(notInts, function (nonInt) { - t['throws']( - function () { ES.AdvanceStringIndex('abc', nonInt); }, - TypeError, - '"index" argument must be an integer, ' + debug(nonInt) + ' is not.' - ); - }); - - forEach(v.nonBooleans, function (nonBoolean) { - t['throws']( - function () { ES.AdvanceStringIndex('abc', 0, nonBoolean); }, - TypeError, - debug(nonBoolean) + ' is not a Boolean' - ); - }); - - var str = 'a' + wholePoo + 'c'; - - t.test('non-unicode mode', function (st) { - for (var i = 0; i < str.length + 2; i += 1) { - st.equal(ES.AdvanceStringIndex(str, i, false), i + 1, i + ' advances to ' + (i + 1)); - } - - st.end(); - }); - - t.test('unicode mode', function (st) { - st.equal(ES.AdvanceStringIndex(str, 0, true), 1, '0 advances to 1'); - st.equal(ES.AdvanceStringIndex(str, 1, true), 3, '1 advances to 3'); - st.equal(ES.AdvanceStringIndex(str, 2, true), 3, '2 advances to 3'); - st.equal(ES.AdvanceStringIndex(str, 3, true), 4, '3 advances to 4'); - st.equal(ES.AdvanceStringIndex(str, 4, true), 5, '4 advances to 5'); - - st.end(); - }); - - t.test('lone surrogates', function (st) { - var halfPoo = 'a' + leadingPoo + 'c'; - - st.equal(ES.AdvanceStringIndex(halfPoo, 0, true), 1, '0 advances to 1'); - st.equal(ES.AdvanceStringIndex(halfPoo, 1, true), 2, '1 advances to 2'); - st.equal(ES.AdvanceStringIndex(halfPoo, 2, true), 3, '2 advances to 3'); - st.equal(ES.AdvanceStringIndex(halfPoo, 3, true), 4, '3 advances to 4'); - - st.end(); - }); - - t.test('surrogate pairs', function (st) { - var lowestPair = String.fromCharCode('0xD800') + String.fromCharCode('0xDC00'); - var highestPair = String.fromCharCode('0xDBFF') + String.fromCharCode('0xDFFF'); - - st.equal(ES.AdvanceStringIndex(lowestPair, 0, true), 2, 'lowest surrogate pair, 0 -> 2'); - st.equal(ES.AdvanceStringIndex(highestPair, 0, true), 2, 'highest surrogate pair, 0 -> 2'); - st.equal(ES.AdvanceStringIndex(wholePoo, 0, true), 2, 'poop, 0 -> 2'); - - st.end(); - }); - - t.end(); - }); - - test('ArrayCreate', function (t) { - forEach(v.nonIntegerNumbers.concat([-1]), function (nonIntegerNumber) { - t['throws']( - function () { ES.ArrayCreate(nonIntegerNumber); }, - TypeError, - 'length must be an integer number >= 0' - ); - }); - - t['throws']( - function () { ES.ArrayCreate(Math.pow(2, 32)); }, - RangeError, - 'length must be < 2**32' - ); - - t.deepEqual(ES.ArrayCreate(-0), [], 'length of -0 creates an empty array'); - t.deepEqual(ES.ArrayCreate(0), [], 'length of +0 creates an empty array'); - // eslint-disable-next-line no-sparse-arrays, comma-spacing - t.deepEqual(ES.ArrayCreate(1), [,], 'length of 1 creates a sparse array of length 1'); - // eslint-disable-next-line no-sparse-arrays, comma-spacing - t.deepEqual(ES.ArrayCreate(2), [,,], 'length of 2 creates a sparse array of length 2'); - - t.test('proto argument', { skip: !$setProto }, function (st) { - var fakeProto = { - push: { toString: function () { return 'not array push'; } } - }; - st.equal(ES.ArrayCreate(0, fakeProto).push, fakeProto.push, 'passing the proto argument works'); - st.end(); - }); - - t.end(); - }); - - test('ArraySetLength', function (t) { - forEach(v.primitives.concat(v.objects), function (nonArray) { - t['throws']( - function () { ES.ArraySetLength(nonArray, { '[[Value]]': 0 }); }, - TypeError, - 'A: ' + debug(nonArray) + ' is not an Array' - ); - }); - - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { ES.ArraySetLength([], primitive); }, - TypeError, - 'Desc: ' + debug(primitive) + ' is not a Property Descriptor' - ); - }); - - t.test('making length nonwritable', { skip: !getOwnPropertyDescriptor }, function (st) { - var a = []; - ES.ArraySetLength(a, { '[[Writable]]': false }); - st.deepEqual( - getOwnPropertyDescriptor(a, 'length'), - { - configurable: false, - enumerable: false, - value: 0, - writable: false - }, - 'without a value, length becomes nonwritable' - ); - st.end(); - }); - - forEach([-1, Math.pow(2, 32)].concat(v.nonIntegerNumbers), function (nonLength) { - t['throws']( - function () { ES.ArraySetLength([], { '[[Value]]': nonLength }); }, - RangeError, - 'a non-integer, negative, or > (2**31 - 1) is not a valid length: ' + debug(nonLength) - ); - }); - - var arr = []; - ES.ArraySetLength(arr, { '[[Value]]': 7 }); - t.equal(arr.length, 7, 'array now has a length of 7'); - - t.end(); - }); - - test('ArraySpeciesCreate', function (t) { - t.test('errors', function (st) { - var testNonNumber = function (nonNumber) { - st['throws']( - function () { ES.ArraySpeciesCreate([], nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a number' - ); - }; - forEach(v.nonNumbers, testNonNumber); - - st['throws']( - function () { ES.ArraySpeciesCreate([], -1); }, - TypeError, - '-1 is not >= 0' - ); - st['throws']( - function () { ES.ArraySpeciesCreate([], -Infinity); }, - TypeError, - '-Infinity is not >= 0' - ); - - var testNonIntegers = function (nonInteger) { - st['throws']( - function () { ES.ArraySpeciesCreate([], nonInteger); }, - TypeError, - debug(nonInteger) + ' is not an integer' - ); - }; - forEach(v.nonIntegerNumbers, testNonIntegers); - - st.end(); - }); - - t.test('works with a non-array', function (st) { - forEach(v.objects.concat(v.primitives), function (nonArray) { - var arr = ES.ArraySpeciesCreate(nonArray, 0); - st.ok(ES.IsArray(arr), 'is an array'); - st.equal(arr.length, 0, 'length is correct'); - st.equal(arr.constructor, Array, 'constructor is correct'); - }); - - st.end(); - }); - - t.test('works with a normal array', function (st) { - var len = 2; - var orig = [1, 2, 3]; - var arr = ES.ArraySpeciesCreate(orig, len); - - st.ok(ES.IsArray(arr), 'is an array'); - st.equal(arr.length, len, 'length is correct'); - st.equal(arr.constructor, orig.constructor, 'constructor is correct'); - - st.end(); - }); - - t.test('-0 length produces +0 length', function (st) { - var len = -0; - st.equal(len, -0, '-0 is negative zero'); - st.notEqual(len, 0, '-0 is not positive zero'); - - var orig = [1, 2, 3]; - var arr = ES.ArraySpeciesCreate(orig, len); - - st.equal(ES.IsArray(arr), true); - st.equal(arr.length, 0); - st.equal(arr.constructor, orig.constructor); - - st.end(); - }); - - t.test('works with species construtor', { skip: !hasSpecies }, function (st) { - var sentinel = {}; - var Foo = function Foo(len) { - this.length = len; - this.sentinel = sentinel; - }; - var Bar = getArraySubclassWithSpeciesConstructor(Foo); - var bar = new Bar(); - - st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); - - var arr = ES.ArraySpeciesCreate(bar, 3); - st.equal(arr.constructor, Foo, 'result used species constructor'); - st.equal(arr.length, 3, 'length property is correct'); - st.equal(arr.sentinel, sentinel, 'Foo constructor was exercised'); - - st.end(); - }); - - t.test('works with null species constructor', { skip: !hasSpecies }, function (st) { - var Bar = getArraySubclassWithSpeciesConstructor(null); - var bar = new Bar(); - - st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); - - var arr = ES.ArraySpeciesCreate(bar, 3); - st.equal(arr.constructor, Array, 'result used default constructor'); - st.equal(arr.length, 3, 'length property is correct'); - - st.end(); - }); - - t.test('works with undefined species constructor', { skip: !hasSpecies }, function (st) { - var Bar = getArraySubclassWithSpeciesConstructor(); - var bar = new Bar(); - - st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); - - var arr = ES.ArraySpeciesCreate(bar, 3); - st.equal(arr.constructor, Array, 'result used default constructor'); - st.equal(arr.length, 3, 'length property is correct'); - - st.end(); - }); - - t.test('throws with object non-construtor species constructor', { skip: !hasSpecies }, function (st) { - forEach(v.objects, function (obj) { - var Bar = getArraySubclassWithSpeciesConstructor(obj); - var bar = new Bar(); - - st.equal(ES.IsArray(bar), true, 'Bar instance is an array'); - - st['throws']( - function () { ES.ArraySpeciesCreate(bar, 3); }, - TypeError, - debug(obj) + ' is not a constructor' - ); - }); - - st.end(); - }); - - t.end(); - }); - - test('Call', function (t) { - var receiver = {}; - var notFuncs = v.nonFunctions.concat([/a/g, new RegExp('a', 'g')]); - t.plan(notFuncs.length + v.nonArrays.length + 5); - - forEach(notFuncs, function (notFunc) { - t['throws']( - function () { return ES.Call(notFunc, receiver); }, - TypeError, - debug(notFunc) + ' (' + typeof notFunc + ') is not callable' - ); - }); - - forEach(v.nonArrays, function (nonArray) { - t['throws']( - function () { ES.Call(Function.prototype, null, nonArray); }, - TypeError, - debug(nonArray) + ' is not an array' - ); - }); - - ES.Call( - function (a, b) { - t.equal(this, receiver, 'context matches expected'); - t.deepEqual([a, b], [1, 2], 'named args are correct'); - t.equal(arguments.length, 3, 'extra argument was passed'); - t.equal(arguments[2], 3, 'extra argument was correct'); - }, - receiver, - [1, 2, 3] - ); - - t.test('Call doesn’t use func.apply', function (st) { - st.plan(4); - - var bad = function (a, b) { - st.equal(this, receiver, 'context matches expected'); - st.deepEqual([a, b], [1, 2], 'named args are correct'); - st.equal(arguments.length, 3, 'extra argument was passed'); - st.equal(arguments[2], 3, 'extra argument was correct'); - }; - - defineProperty(bad, 'apply', { - value: function () { - st.fail('bad.apply shouldn’t get called'); - } - }); - - ES.Call(bad, receiver, [1, 2, 3]); - st.end(); - }); - - t.end(); - }); - - test('CanonicalNumericIndexString', function (t) { - var throwsOnNonString = function (notString) { - t['throws']( - function () { return ES.CanonicalNumericIndexString(notString); }, - TypeError, - debug(notString) + ' is not a string' - ); - }; - forEach(v.objects.concat(v.numbers), throwsOnNonString); - t.equal(ES.CanonicalNumericIndexString('-0'), -0, '"-0" returns -0'); - for (var i = -50; i < 50; i += 10) { - t.equal(i, ES.CanonicalNumericIndexString(String(i)), '"' + i + '" returns ' + i); - t.equal(undefined, ES.CanonicalNumericIndexString(String(i) + 'a'), '"' + i + 'a" returns undefined'); - } - t.end(); - }); - - test('CompletePropertyDescriptor', function (t) { - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { ES.CompletePropertyDescriptor(primitive); }, - TypeError, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - var generic = v.genericDescriptor(); - t.deepEqual( - ES.CompletePropertyDescriptor(generic), - { - '[[Configurable]]': !!generic['[[Configurable]]'], - '[[Enumerable]]': !!generic['[[Enumerable]]'], - '[[Value]]': undefined, - '[[Writable]]': false - }, - 'completes a Generic Descriptor' - ); - - var data = v.dataDescriptor(); - t.deepEqual( - ES.CompletePropertyDescriptor(data), - { - '[[Configurable]]': !!data['[[Configurable]]'], - '[[Enumerable]]': false, - '[[Value]]': data['[[Value]]'], - '[[Writable]]': !!data['[[Writable]]'] - }, - 'completes a Data Descriptor' - ); - - var accessor = v.accessorDescriptor(); - t.deepEqual( - ES.CompletePropertyDescriptor(accessor), - { - '[[Get]]': accessor['[[Get]]'], - '[[Enumerable]]': !!accessor['[[Enumerable]]'], - '[[Configurable]]': !!accessor['[[Configurable]]'], - '[[Set]]': undefined - }, - 'completes an Accessor Descriptor' - ); - - var mutator = v.mutatorDescriptor(); - t.deepEqual( - ES.CompletePropertyDescriptor(mutator), - { - '[[Set]]': mutator['[[Set]]'], - '[[Enumerable]]': !!mutator['[[Enumerable]]'], - '[[Configurable]]': !!mutator['[[Configurable]]'], - '[[Get]]': undefined - }, - 'completes a mutator Descriptor' - ); - - t['throws']( - function () { ES.CompletePropertyDescriptor(v.bothDescriptor()); }, - TypeError, - 'data and accessor descriptors are mutually exclusive' - ); - - t.end(); - }); - - test('CreateDataProperty', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.CreateDataProperty(primitive); }, - TypeError, - debug(primitive) + ' is not an object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.CreateDataProperty({}, nonPropertyKey); }, - TypeError, - debug(nonPropertyKey) + ' is not a property key' - ); - }); - - var sentinel = { id: 'sentinel' }; - var secondSentinel = { id: 'second sentinel' }; - forEach(v.propertyKeys, function (propertyKey) { - var obj = {}; - var status = ES.CreateDataProperty(obj, propertyKey, sentinel); - t.equal(status, true, 'status is true'); - t.equal( - obj[propertyKey], - sentinel, - debug(sentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' - ); - var secondStatus = ES.CreateDataProperty(obj, propertyKey, secondSentinel); - t.equal(secondStatus, true, 'second status is true'); - t.equal( - obj[propertyKey], - secondSentinel, - debug(secondSentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' - ); - - t.test('with defineProperty', { skip: !defineProperty.oDP }, function (st) { - var nonWritable = defineProperty({}, propertyKey, { configurable: true, writable: false }); - - var nonWritableStatus = ES.CreateDataProperty(nonWritable, propertyKey, sentinel); - st.equal(nonWritableStatus, false, 'create data property failed'); - st.notEqual( - nonWritable[propertyKey], - sentinel, - debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object when key is nonwritable' - ); - - var nonConfigurable = defineProperty({}, propertyKey, { configurable: false, writable: true }); - - var nonConfigurableStatus = ES.CreateDataProperty(nonConfigurable, propertyKey, sentinel); - st.equal(nonConfigurableStatus, false, 'create data property failed'); - st.notEqual( - nonConfigurable[propertyKey], - sentinel, - debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object when key is nonconfigurable' - ); - st.end(); - }); - }); - - t.end(); - }); - - test('CreateDataPropertyOrThrow', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.CreateDataPropertyOrThrow(primitive); }, - TypeError, - debug(primitive) + ' is not an object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.CreateDataPropertyOrThrow({}, nonPropertyKey); }, - TypeError, - debug(nonPropertyKey) + ' is not a property key' - ); - }); - - var sentinel = {}; - forEach(v.propertyKeys, function (propertyKey) { - var obj = {}; - var status = ES.CreateDataPropertyOrThrow(obj, propertyKey, sentinel); - t.equal(status, true, 'status is true'); - t.equal( - obj[propertyKey], - sentinel, - debug(sentinel) + ' is installed on "' + debug(propertyKey) + '" on the object' - ); - - if (typeof Object.preventExtensions === 'function') { - var notExtensible = {}; - Object.preventExtensions(notExtensible); - - t['throws']( - function () { ES.CreateDataPropertyOrThrow(notExtensible, propertyKey, sentinel); }, - TypeError, - 'can not install ' + debug(propertyKey) + ' on non-extensible object' - ); - t.notEqual( - notExtensible[propertyKey], - sentinel, - debug(sentinel) + ' is not installed on "' + debug(propertyKey) + '" on the object' - ); - } - }); - - t.end(); - }); - - test('CreateListFromArrayLike', function (t) { - forEach(v.primitives, function (nonObject) { - t['throws']( - function () { ES.CreateListFromArrayLike(nonObject); }, - TypeError, - debug(nonObject) + ' is not an Object' - ); - }); - forEach(v.nonArrays, function (nonArray) { - t['throws']( - function () { ES.CreateListFromArrayLike({}, nonArray); }, - TypeError, - debug(nonArray) + ' is not an Array' - ); - }); - - t.deepEqual( - ES.CreateListFromArrayLike({ length: 2, 0: 'a', 1: 'b', 2: 'c' }), - ['a', 'b'], - 'arraylike stops at the length' - ); - - t.end(); - }); - - test('CreateHTML', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.CreateHTML('', nonString, '', ''); }, - TypeError, - 'tag: ' + debug(nonString) + ' is not a String' - ); - t['throws']( - function () { ES.CreateHTML('', '', nonString, ''); }, - TypeError, - 'attribute: ' + debug(nonString) + ' is not a String' - ); - }); - - t.equal( - ES.CreateHTML( - { toString: function () { return 'the string'; } }, - 'some HTML tag!', - '' - ), - 'the string', - 'works with an empty string attribute value' - ); - - t.equal( - ES.CreateHTML( - { toString: function () { return 'the string'; } }, - 'some HTML tag!', - 'attr', - 'value "with quotes"' - ), - 'the string', - 'works with an attribute, and a value with quotes' - ); - - t.end(); - }); - - test('CreateMethodProperty', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.CreateMethodProperty(primitive, 'key'); }, - TypeError, - 'O must be an Object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.CreateMethodProperty({}, nonPropertyKey); }, - TypeError, - debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - t.test('defines correctly', function (st) { - var obj = {}; - var key = 'the key'; - var value = { foo: 'bar' }; - - st.equal(ES.CreateMethodProperty(obj, key, value), true, 'defines property successfully'); - st.test('property descriptor', { skip: !getOwnPropertyDescriptor }, function (s2t) { - s2t.deepEqual( - getOwnPropertyDescriptor(obj, key), - { - configurable: true, - enumerable: false, - value: value, - writable: true - }, - 'sets the correct property descriptor' - ); - - s2t.end(); - }); - st.equal(obj[key], value, 'sets the correct value'); - - st.end(); - }); - - t.test('fails as expected on a frozen object', { skip: !Object.freeze }, function (st) { - var obj = Object.freeze({ foo: 'bar' }); - st['throws']( - function () { ES.CreateMethodProperty(obj, 'foo', { value: 'baz' }); }, - TypeError, - 'nonconfigurable key can not be defined' - ); - - st.end(); - }); - - t.test('fails as expected on a function with a nonconfigurable name', { skip: !functionsHaveNames || functionsHaveConfigurableNames }, function (st) { - st['throws']( - function () { ES.CreateMethodProperty(function () {}, 'name', { value: 'baz' }); }, - TypeError, - 'nonconfigurable function name can not be defined' - ); - st.end(); - }); - - t.end(); - }); - - test('CreateIterResultObject', function (t) { - forEach(v.nonBooleans, function (nonBoolean) { - t['throws']( - function () { ES.CreateIterResultObject({}, nonBoolean); }, - TypeError, - '"done" argument must be a boolean; ' + debug(nonBoolean) + ' is not' - ); - }); - - var value = {}; - t.deepEqual( - ES.CreateIterResultObject(value, true), - { value: value, done: true }, - 'creates a "done" iteration result' - ); - t.deepEqual( - ES.CreateIterResultObject(value, false), - { value: value, done: false }, - 'creates a "not done" iteration result' - ); - - t.end(); - }); - - test('DefinePropertyOrThrow', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.DefinePropertyOrThrow(primitive, 'key', {}); }, - TypeError, - 'O must be an Object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.DefinePropertyOrThrow({}, nonPropertyKey, {}); }, - TypeError, - debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - t.test('defines correctly', function (st) { - var obj = {}; - var key = 'the key'; - var descriptor = { - configurable: true, - enumerable: false, - value: { foo: 'bar' }, - writable: true - }; - - st.equal(ES.DefinePropertyOrThrow(obj, key, descriptor), true, 'defines property successfully'); - st.test('property descriptor', { skip: !getOwnPropertyDescriptor }, function (s2t) { - s2t.deepEqual( - getOwnPropertyDescriptor(obj, key), - descriptor, - 'sets the correct property descriptor' - ); - - s2t.end(); - }); - st.deepEqual(obj[key], descriptor.value, 'sets the correct value'); - - st.end(); - }); - - t.test('fails as expected on a frozen object', { skip: !Object.freeze }, function (st) { - var obj = Object.freeze({ foo: 'bar' }); - st['throws']( - function () { - ES.DefinePropertyOrThrow(obj, 'foo', { configurable: true, value: 'baz' }); - }, - TypeError, - 'nonconfigurable key can not be defined' - ); - - st.end(); - }); - - t.test('fails as expected on a function with a nonconfigurable name', { skip: !functionsHaveNames || functionsHaveConfigurableNames }, function (st) { - st['throws']( - function () { - ES.DefinePropertyOrThrow(function () {}, 'name', { configurable: true, value: 'baz' }); - }, - TypeError, - 'nonconfigurable function name can not be defined' - ); - st.end(); - }); - - t.end(); - }); - - test('DeletePropertyOrThrow', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.DeletePropertyOrThrow(primitive, 'key', {}); }, - TypeError, - 'O must be an Object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.DeletePropertyOrThrow({}, nonPropertyKey, {}); }, - TypeError, - debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - t.test('defines correctly', function (st) { - var obj = { 'the key': 42 }; - var key = 'the key'; - - st.equal(ES.DeletePropertyOrThrow(obj, key), true, 'deletes property successfully'); - st.equal(key in obj, false, 'key is no longer in the object'); - - st.end(); - }); - - t.test('fails as expected on a frozen object', { skip: !Object.freeze }, function (st) { - var obj = Object.freeze({ foo: 'bar' }); - st['throws']( - function () { ES.DeletePropertyOrThrow(obj, 'foo'); }, - TypeError, - 'nonconfigurable key can not be deleted' - ); - - st.end(); - }); - - t.test('fails as expected on a function with a nonconfigurable name', { skip: !functionsHaveNames || functionsHaveConfigurableNames }, function (st) { - st['throws']( - function () { ES.DeletePropertyOrThrow(function () {}, 'name'); }, - TypeError, - 'nonconfigurable function name can not be deleted' - ); - st.end(); - }); - - t.end(); - }); - - test('EnumerableOwnNames', function (t) { - var obj = testEnumerableOwnNames(t, function (O) { return ES.EnumerableOwnNames(O); }); - - t.deepEqual( - ES.EnumerableOwnNames(obj), - ['own'], - 'returns enumerable own names' - ); - - t.end(); - }); - - test('FromPropertyDescriptor', function (t) { - t.equal(ES.FromPropertyDescriptor(), undefined, 'no value begets undefined'); - t.equal(ES.FromPropertyDescriptor(undefined), undefined, 'undefined value begets undefined'); - - forEach(v.nonUndefinedPrimitives, function (primitive) { - t['throws']( - function () { ES.FromPropertyDescriptor(primitive); }, - TypeError, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - var accessor = v.accessorDescriptor(); - t.deepEqual(ES.FromPropertyDescriptor(accessor), { - get: accessor['[[Get]]'], - enumerable: !!accessor['[[Enumerable]]'], - configurable: !!accessor['[[Configurable]]'] - }); - - var mutator = v.mutatorDescriptor(); - t.deepEqual(ES.FromPropertyDescriptor(mutator), { - set: mutator['[[Set]]'], - enumerable: !!mutator['[[Enumerable]]'], - configurable: !!mutator['[[Configurable]]'] - }); - var data = v.dataDescriptor(); - t.deepEqual(ES.FromPropertyDescriptor(data), { - value: data['[[Value]]'], - writable: data['[[Writable]]'] - }); - - t.deepEqual(ES.FromPropertyDescriptor(v.genericDescriptor()), { - enumerable: false, - configurable: true - }); - - var both = v.bothDescriptor(); - t['throws']( - function () { - ES.FromPropertyDescriptor({ get: both['[[Get]]'], value: both['[[Value]]'] }); - }, - TypeError, - 'data and accessor descriptors are mutually exclusive' - ); - - t.end(); - }); - - test('Get', function (t) { - t['throws'](function () { return ES.Get('a', 'a'); }, TypeError, 'Throws a TypeError if `O` is not an Object'); - t['throws'](function () { return ES.Get({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); - - var value = {}; - t.test('Symbols', { skip: !v.hasSymbols }, function (st) { - var sym = Symbol('sym'); - var obj = {}; - obj[sym] = value; - st.equal(ES.Get(obj, sym), value, 'returns property `P` if it exists on object `O`'); - st.end(); - }); - t.equal(ES.Get({ a: value }, 'a'), value, 'returns property `P` if it exists on object `O`'); - t.end(); - }); - - test('GetIterator', function (t) { - var arr = [1, 2]; - testIterator(t, ES.GetIterator(arr), arr); - - testIterator(t, ES.GetIterator('abc'), 'abc'.split('')); - - var sentinel = {}; - forEach(v.primitives, function (nonObject) { - var method = function () { - return nonObject; - }; - t['throws']( - function () { ES.GetIterator(sentinel, method); }, - TypeError, - debug(nonObject) + ' is not an Object; iterator method must return an Object' - ); - }); - - var i = 0; - var manualMethod = function () { - t.equal(this, sentinel, 'receiver is expected object'); - return { - next: function () { - var value = arr[i]; - i += 1; - return { - done: i > arr.length, - value: value - }; - } - }; - }; - testIterator(t, ES.GetIterator(sentinel, manualMethod), arr); - - t.test('Symbol.iterator', { skip: !v.hasSymbols }, function (st) { - var m = new Map(); - m.set(1, 'a'); - m.set(2, 'b'); - - testIterator(st, ES.GetIterator(m), [[1, 'a'], [2, 'b']]); - - forEach(v.primitives, function (nonObject) { - var badIterable = {}; - badIterable[Symbol.iterator] = function () { - return nonObject; - }; - st['throws']( - function () { return ES.GetIterator(badIterable); }, - TypeError, - debug(nonObject) + ' is not an Object; iterator method must return an Object' - ); - }); - - st.end(); - }); - - t.end(); - }); - - test('GetMethod', function (t) { - t['throws'](function () { return ES.GetMethod({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); - t.equal(ES.GetMethod({}, 'a'), undefined, 'returns undefined in property is undefined'); - t.equal(ES.GetMethod({ a: null }, 'a'), undefined, 'returns undefined if property is null'); - t.equal(ES.GetMethod({ a: undefined }, 'a'), undefined, 'returns undefined if property is undefined'); - var obj = { a: function () {} }; - t['throws'](function () { ES.GetMethod({ a: 'b' }, 'a'); }, TypeError, 'throws TypeError if property exists and is not callable'); - t.equal(ES.GetMethod(obj, 'a'), obj.a, 'returns property if it is callable'); - t.end(); - }); - - test('GetOwnPropertyKeys', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.GetOwnPropertyKeys(primitive, 'String'); }, - TypeError, - 'O: ' + debug(primitive) + ' is not an Object' - ); - }); - - t['throws']( - function () { ES.GetOwnPropertyKeys({}, 'not string or symbol'); }, - TypeError, - 'Type: must be "String" or "Symbol"' - ); - - t.test('Symbols', { skip: !v.hasSymbols }, function (st) { - var O = { a: 1 }; - O[Symbol.iterator] = true; - var s = Symbol('test'); - defineProperty(O, s, { enumerable: false, value: true }); - - st.deepEqual( - ES.GetOwnPropertyKeys(O, 'Symbol'), - [Symbol.iterator, s], - 'works with Symbols, enumerable or not' - ); - - st.end(); - }); - - t.test('non-enumerable names', { skip: !defineProperty.oDP }, function (st) { - var O = { a: 1 }; - defineProperty(O, 'b', { enumerable: false, value: 2 }); - if (v.hasSymbols) { - O[Symbol.iterator] = true; - } - - st.deepEqual( - ES.GetOwnPropertyKeys(O, 'String').sort(), - ['a', 'b'].sort(), - 'works with Strings, enumerable or not' - ); - - st.end(); - }); - - t.deepEqual( - ES.GetOwnPropertyKeys({ a: 1, b: 2 }, 'String').sort(), - ['a', 'b'].sort(), - 'works with enumerable keys' - ); - - t.end(); - }); - - test('GetPrototypeFromConstructor', function (t) { - forEach(v.nonFunctions, function (nonFunction) { - t['throws']( - function () { ES.GetPrototypeFromConstructor(nonFunction, '%Array%'); }, - TypeError, - debug(nonFunction) + ' is not a constructor' - ); - }); - - forEach(arrowFns, function (arrowFn) { - t['throws']( - function () { ES.GetPrototypeFromConstructor(arrowFn, '%Array%'); }, - TypeError, - debug(arrowFn) + ' is not a constructor' - ); - }); - - var f = function () {}; - t.equal( - ES.GetPrototypeFromConstructor(f, '%Array.prototype%'), - f.prototype, - 'function with normal `prototype` property returns it' - ); - forEach([true, 'foo', 42], function (truthyPrimitive) { - f.prototype = truthyPrimitive; - t.equal( - ES.GetPrototypeFromConstructor(f, '%Array.prototype%'), - Array.prototype, - 'function with non-object `prototype` property (' + debug(truthyPrimitive) + ') returns default intrinsic' - ); - }); - - t.end(); - }); - - test('GetSubstitution', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.GetSubstitution(nonString, '', 0, [], ''); }, - TypeError, - '`matched`: ' + debug(nonString) + ' is not a String' - ); - - t['throws']( - function () { ES.GetSubstitution('', nonString, 0, [], ''); }, - TypeError, - '`str`: ' + debug(nonString) + ' is not a String' - ); - - t['throws']( - function () { ES.GetSubstitution('', '', 0, [], nonString); }, - TypeError, - '`replacement`: ' + debug(nonString) + ' is not a String' - ); - - if (canDistinguishSparseFromUndefined || typeof nonString !== 'undefined') { - t['throws']( - function () { ES.GetSubstitution('', '', 0, [nonString], ''); }, - TypeError, - '`captures`: ' + debug([nonString]) + ' is not an Array of strings' - ); - } - }); - - forEach(v.notNonNegativeIntegers, function (nonNonNegativeInteger) { - t['throws']( - function () { ES.GetSubstitution('', '', nonNonNegativeInteger, [], ''); }, - TypeError, - '`position`: ' + debug(nonNonNegativeInteger) + ' is not a non-negative integer' - ); - }); - - forEach(v.nonArrays, function (nonArray) { - t['throws']( - function () { ES.GetSubstitution('', '', 0, nonArray, ''); }, - TypeError, - '`captures`: ' + debug(nonArray) + ' is not an Array' - ); - }); - - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 3, [], '123'), - '123', - 'returns the substitution' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '$$2$'), - '$2$', - 'supports $$, and trailing $' - ); - - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$&<'), - '>abcdef<', - 'supports $&' - ); - - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$`<'), - '><', - 'supports $` at position 0' - ); - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 3, [], '>$`<'), - '>ab<', - 'supports $` at position > 0' - ); - - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 7, [], ">$'<"), - '><', - "supports $' at a position where there's less than `matched.length` chars left" - ); - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 3, [], ">$'<"), - '>ghi<', - "supports $' at a position where there's more than `matched.length` chars left" - ); - - for (var i = 0; i < 100; i += 1) { - var captures = []; - captures[i] = 'test'; - if (i > 0) { - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$' + i + '<'), - '>undefined<', - 'supports $' + i + ' with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$' + i), - '>undefined', - 'supports $' + i + ' at the end of the replacement, with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$' + i + '<'), - '><', - 'supports $' + i + ' with a capture at that index' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$' + i), - '>', - 'supports $' + i + ' at the end of the replacement, with a capture at that index' - ); - } - if (i < 10) { - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$0' + i + '<'), - i === 0 ? '><' : '>undefined<', - 'supports $0' + i + ' with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], '>$0' + i), - i === 0 ? '>' : '>undefined', - 'supports $0' + i + ' at the end of the replacement, with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$0' + i + '<'), - '><', - 'supports $0' + i + ' with a capture at that index' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, '>$0' + i), - '>', - 'supports $0' + i + ' at the end of the replacement, with a capture at that index' - ); - } - } - - t.end(); - }); - - test('GetV', function (t) { - t['throws'](function () { return ES.GetV({ 7: 7 }, 7); }, TypeError, 'Throws a TypeError if `P` is not a property key'); - var obj = { a: function () {} }; - t.equal(ES.GetV(obj, 'a'), obj.a, 'returns property if it exists'); - t.equal(ES.GetV(obj, 'b'), undefined, 'returns undefiend if property does not exist'); - t.end(); - }); - - test('HasOwnProperty', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.HasOwnProperty(primitive, 'key'); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonKey) { - t['throws']( - function () { ES.HasOwnProperty({}, nonKey); }, - TypeError, - debug(nonKey) + ' is not a Property Key' - ); - }); - - t.equal(ES.HasOwnProperty({}, 'toString'), false, 'inherited properties are not own'); - t.equal( - ES.HasOwnProperty({ toString: 1 }, 'toString'), - true, - 'shadowed inherited own properties are own' - ); - t.equal(ES.HasOwnProperty({ a: 1 }, 'a'), true, 'own properties are own'); - - t.end(); - }); - - test('HasProperty', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.HasProperty(primitive, 'key'); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonKey) { - t['throws']( - function () { ES.HasProperty({}, nonKey); }, - TypeError, - debug(nonKey) + ' is not a Property Key' - ); - }); - - t.equal(ES.HasProperty({}, 'nope'), false, 'object does not have nonexistent properties'); - t.equal(ES.HasProperty({}, 'toString'), true, 'object has inherited properties'); - t.equal( - ES.HasProperty({ toString: 1 }, 'toString'), - true, - 'object has shadowed inherited own properties' - ); - t.equal(ES.HasProperty({ a: 1 }, 'a'), true, 'object has own properties'); - - t.end(); - }); - - test('InstanceofOperator', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.InstanceofOperator(primitive, function () {}); }, - TypeError, - debug(primitive) + ' is not an object' - ); - }); - - forEach(v.nonFunctions, function (nonFunction) { - t['throws']( - function () { ES.InstanceofOperator({}, nonFunction); }, - TypeError, - debug(nonFunction) + ' is not callable' - ); - }); - - var C = function C() {}; - var D = function D() {}; - - t.equal(ES.InstanceofOperator(new C(), C), true, 'constructor function has an instance of itself'); - t.equal(ES.InstanceofOperator(new D(), C), false, 'constructor/instance mismatch is false'); - t.equal(ES.InstanceofOperator(new C(), D), false, 'instance/constructor mismatch is false'); - t.equal(ES.InstanceofOperator({}, C), false, 'plain object is not an instance of a constructor'); - t.equal(ES.InstanceofOperator({}, Object), true, 'plain object is an instance of Object'); - - t.test('Symbol.hasInstance', { skip: !v.hasSymbols || !Symbol.hasInstance }, function (st) { - st.plan(5); - - var O = {}; - var C2 = function () {}; - st.equal(ES.InstanceofOperator(O, C2), false, 'O is not an instance of C2'); - - defineProperty(C2, Symbol.hasInstance, { - configurable: true, - value: function (obj) { - st.equal(this, C2, 'hasInstance receiver is C2'); - st.equal(obj, O, 'hasInstance argument is O'); - - return {}; // testing coercion to boolean - } - }); - - st.equal(ES.InstanceofOperator(O, C2), true, 'O is now an instance of C2'); - - defineProperty(C2, Symbol.hasInstance, { - configurable: true, - value: undefined - }); - - st.equal(ES.InstanceofOperator(O, C2), false, 'O is no longer an instance of C2'); - - st.end(); - }); - - t.end(); - }); - - test('Invoke', function (t) { - forEach(v.nonPropertyKeys, function (nonKey) { - t['throws']( - function () { ES.Invoke({}, nonKey); }, - TypeError, - debug(nonKey) + ' is not a Property Key' - ); - }); - - t['throws']( - function () { ES.Invoke({ o: false }, 'o'); }, - TypeError, - 'fails on a non-function' - ); - - forEach(v.nonArrays, function (nonArray) { - t['throws']( - function () { ES.Invoke({}, '', nonArray); }, - TypeError, - debug(nonArray) + ' is not an Array' - ); - }); - - t.test('invoked callback', function (st) { - var aValue = {}; - var bValue = {}; - var obj = { - f: function (a) { - st.equal(arguments.length, 2, '2 args passed'); - st.equal(a, aValue, 'first arg is correct'); - st.equal(arguments[1], bValue, 'second arg is correct'); - } - }; - st.plan(3); - ES.Invoke(obj, 'f', [aValue, bValue]); - }); - - t.end(); - }); - - test('IsArray', function (t) { - t.equal(true, ES.IsArray([]), '[] is array'); - t.equal(false, ES.IsArray({}), '{} is not array'); - t.equal(false, ES.IsArray({ length: 1, 0: true }), 'arraylike object is not array'); - forEach(v.objects.concat(v.primitives), function (value) { - t.equal(false, ES.IsArray(value), debug(value) + ' is not array'); - }); - t.end(); - }); - - test('IsConcatSpreadable', function (t) { - forEach(v.primitives, function (primitive) { - t.equal(ES.IsConcatSpreadable(primitive), false, debug(primitive) + ' is not an Object'); - }); - - var hasSymbolConcatSpreadable = v.hasSymbols && Symbol.isConcatSpreadable; - t.test('Symbol.isConcatSpreadable', { skip: !hasSymbolConcatSpreadable }, function (st) { - forEach(v.falsies, function (falsy) { - var obj = {}; - obj[Symbol.isConcatSpreadable] = falsy; - st.equal( - ES.IsConcatSpreadable(obj), - false, - 'an object with ' + debug(falsy) + ' as Symbol.isConcatSpreadable is not concat spreadable' - ); - }); - - forEach(v.truthies, function (truthy) { - var obj = {}; - obj[Symbol.isConcatSpreadable] = truthy; - st.equal( - ES.IsConcatSpreadable(obj), - true, - 'an object with ' + debug(truthy) + ' as Symbol.isConcatSpreadable is concat spreadable' - ); - }); - - st.end(); - }); - - forEach(v.objects, function (object) { - t.equal( - ES.IsConcatSpreadable(object), - false, - 'non-array without Symbol.isConcatSpreadable is not concat spreadable' - ); - }); - - t.equal(ES.IsConcatSpreadable([]), true, 'arrays are concat spreadable'); - - t.end(); - }); - - test('IsConstructor', function (t) { - t.equal(true, ES.IsConstructor(function () {}), 'function is constructor'); - t.equal(false, ES.IsConstructor(/a/g), 'regex is not constructor'); - forEach(v.objects, function (object) { - t.equal(false, ES.IsConstructor(object), object + ' object is not constructor'); - }); - - try { - var arrow = Function('return () => {}')(); // eslint-disable-line no-new-func - t.equal(ES.IsConstructor(arrow), false, 'arrow function is not constructor'); - } catch (e) { - t.comment('SKIP: arrow function syntax not supported.'); - } - - try { - var foo = Function('return class Foo {}')(); // eslint-disable-line no-new-func - t.equal(ES.IsConstructor(foo), true, 'class is constructor'); - } catch (e) { - t.comment('SKIP: class syntax not supported.'); - } - - if (typeof Reflect !== 'object' || typeof Proxy !== 'function' || has(Proxy, 'prototype')) { - t.comment('SKIP: Proxy is constructor'); - } else { - t.equal(ES.IsConstructor(Proxy), true, 'Proxy is constructor'); - } - - t.end(); - }); - - test('IsExtensible', function (t) { - forEach(v.objects, function (object) { - t.equal(true, ES.IsExtensible(object), debug(object) + ' object is extensible'); - }); - forEach(v.primitives, function (primitive) { - t.equal(false, ES.IsExtensible(primitive), debug(primitive) + ' is not extensible'); - }); - if (Object.preventExtensions) { - t.equal(false, ES.IsExtensible(Object.preventExtensions({})), 'object with extensions prevented is not extensible'); - } - t.end(); - }); - - test('IsPromise', { skip: typeof Promise !== 'function' }, function (t) { - forEach(v.objects.concat(v.primitives), function (nonPromise) { - t.equal(ES.IsPromise(nonPromise), false, debug(nonPromise) + ' is not a Promise'); - }); - - var thenable = { then: Promise.prototype.then }; - t.equal(ES.IsPromise(thenable), false, 'generic thenable is not a Promise'); - - t.equal(ES.IsPromise(Promise.resolve()), true, 'Promise is a Promise'); - - t.end(); - }); - - test('IsPropertyDescriptor', function (t) { - forEach(v.primitives, function (primitive) { - t.equal( - ES.IsPropertyDescriptor(primitive), - false, - debug(primitive) + ' is not a Property Descriptor' - ); - }); - - t.equal(ES.IsPropertyDescriptor({ invalid: true }), false, 'invalid keys not allowed on a Property Descriptor'); - - t.equal(ES.IsPropertyDescriptor({}), true, 'empty object is an incomplete Property Descriptor'); - - t.equal(ES.IsPropertyDescriptor(v.accessorDescriptor()), true, 'accessor descriptor is a Property Descriptor'); - t.equal(ES.IsPropertyDescriptor(v.mutatorDescriptor()), true, 'mutator descriptor is a Property Descriptor'); - t.equal(ES.IsPropertyDescriptor(v.dataDescriptor()), true, 'data descriptor is a Property Descriptor'); - t.equal(ES.IsPropertyDescriptor(v.genericDescriptor()), true, 'generic descriptor is a Property Descriptor'); - - t['throws']( - function () { ES.IsPropertyDescriptor(v.bothDescriptor()); }, - TypeError, - 'a Property Descriptor can not be both a Data and an Accessor Descriptor' - ); - - t['throws']( - function () { ES.IsPropertyDescriptor(v.bothDescriptorWritable()); }, - TypeError, - 'a Property Descriptor can not be both a Data and an Accessor Descriptor' - ); - - t.end(); - }); - - test('IsPropertyKey', function (t) { - forEach(v.numbers.concat(v.objects), function (notKey) { - t.equal(false, ES.IsPropertyKey(notKey), debug(notKey) + ' is not property key'); - }); - - t.equal(true, ES.IsPropertyKey('foo'), 'string is property key'); - - forEach(v.symbols, function (symbol) { - t.equal(true, ES.IsPropertyKey(symbol), debug(symbol) + ' is property key'); - }); - t.end(); - }); - - test('IsRegExp', function (t) { - forEach([/a/g, new RegExp('a', 'g')], function (regex) { - t.equal(true, ES.IsRegExp(regex), regex + ' is regex'); - }); - - forEach(v.objects.concat(v.primitives), function (nonRegex) { - t.equal(false, ES.IsRegExp(nonRegex), debug(nonRegex) + ' is not regex'); - }); - - t.test('Symbol.match', { skip: !v.hasSymbols || !Symbol.match }, function (st) { - var obj = {}; - obj[Symbol.match] = true; - st.equal(true, ES.IsRegExp(obj), 'object with truthy Symbol.match is regex'); - - var regex = /a/; - defineProperty(regex, Symbol.match, { value: false }); - st.equal(false, ES.IsRegExp(regex), 'regex with falsy Symbol.match is not regex'); - - st.end(); - }); - - t.end(); - }); - - test('IsInteger', function (t) { - for (var i = -100; i < 100; i += 10) { - t.equal(true, ES.IsInteger(i), i + ' is integer'); - t.equal(false, ES.IsInteger(i + 0.2), (i + 0.2) + ' is not integer'); - } - t.equal(true, ES.IsInteger(-0), '-0 is integer'); - var notInts = v.nonNumbers.concat(v.nonIntegerNumbers, v.infinities, [NaN, [], new Date()]); - forEach(notInts, function (notInt) { - t.equal(false, ES.IsInteger(notInt), debug(notInt) + ' is not integer'); - }); - t.equal(false, ES.IsInteger(v.uncoercibleObject), 'uncoercibleObject is not integer'); - t.end(); - }); - - test('IteratorNext', function (t) { - forEach(v.primitives, function (nonObject) { - t['throws']( - function () { ES.IteratorNext(nonObject); }, - TypeError, - debug(nonObject) + ' is not an Object' - ); - - t['throws']( - function () { ES.IteratorNext({ next: function () { return nonObject; } }); }, - TypeError, - '`next()` returns ' + debug(nonObject) + ', which is not an Object' - ); - }); - - var iterator = { - next: function (value) { - return [arguments.length, value]; - } - }; - t.deepEqual( - ES.IteratorNext(iterator), - [0, undefined], - 'returns expected value from `.next()`; `next` receives expected 0 arguments' - ); - t.deepEqual( - ES.IteratorNext(iterator, iterator), - [1, iterator], - 'returns expected value from `.next()`; `next` receives expected 1 argument' - ); - - t.end(); - }); - - test('IteratorComplete', function (t) { - forEach(v.primitives, function (nonObject) { - t['throws']( - function () { ES.IteratorComplete(nonObject); }, - TypeError, - debug(nonObject) + ' is not an Object' - ); - }); - - forEach(v.truthies, function (truthy) { - t.equal(ES.IteratorComplete({ done: truthy }), true, '{ done: ' + debug(truthy) + ' } is true'); - }); - - forEach(v.falsies, function (falsy) { - t.equal(ES.IteratorComplete({ done: falsy }), false, '{ done: ' + debug(falsy) + ' } is false'); - }); - - t.end(); - }); - - test('IteratorValue', function (t) { - forEach(v.primitives, function (nonObject) { - t['throws']( - function () { ES.IteratorValue(nonObject); }, - TypeError, - debug(nonObject) + ' is not an Object' - ); - }); - - var sentinel = {}; - t.equal(ES.IteratorValue({ value: sentinel }), sentinel, 'Gets `.value` off the object'); - - t.end(); - }); - - test('IteratorStep', function (t) { - t.deepEqual( - ES.IteratorStep({ - next: function () { - return { - done: false, - value: [1, arguments.length] - }; - } - }), - { done: false, value: [1, 0] }, - 'not-done iterator result yields iterator result' - ); - t.deepEqual( - ES.IteratorStep({ - next: function () { - return { - done: true, - value: [2, arguments.length] - }; - } - }), - false, - 'done iterator result yields false' - ); - - t.end(); - }); - - test('IteratorClose', function (t) { - forEach(v.primitives, function (nonObject) { - t['throws']( - function () { ES.IteratorClose(nonObject); }, - TypeError, - debug(nonObject) + ' is not an Object' - ); - - t['throws']( - function () { ES.IteratorClose({ 'return': function () { return nonObject; } }, function () {}); }, - TypeError, - '`.return` returns ' + debug(nonObject) + ', which is not an Object' - ); - }); - - forEach(v.nonFunctions, function (nonFunction) { - t['throws']( - function () { ES.IteratorClose({}, nonFunction); }, - TypeError, - debug(nonFunction) + ' is not a thunk for a Completion Record' - ); - - if (nonFunction != null) { - t['throws']( - function () { ES.IteratorClose({ 'return': nonFunction }, function () {}); }, - TypeError, - '`.return` of ' + debug(nonFunction) + ' is not a Function' - ); - } - }); - - var sentinel = {}; - t.equal( - ES.IteratorClose({ 'return': undefined }, function () { return sentinel; }), - sentinel, - 'when `.return` is `undefined`, invokes and returns the completion thunk' - ); - - /* eslint no-throw-literal: 0 */ - t['throws']( - function () { ES.IteratorClose({ 'return': function () { throw sentinel; } }, function () {}); }, - sentinel, - '`.return` that throws, when completionThunk does not, throws exception from `.return`' - ); - t['throws']( - function () { ES.IteratorClose({ 'return': function () { throw sentinel; } }, function () { throw -1; }); }, - -1, - '`.return` that throws, when completionThunk does too, throws exception from completionThunk' - ); - t['throws']( - function () { ES.IteratorClose({ 'return': function () { } }, function () { throw -1; }); }, - -1, - '`.return` that does not throw, when completionThunk does, throws exception from completionThunk' - ); - - t.equal( - ES.IteratorClose({ 'return': function () { return sentinel; } }, function () { return 42; }), - 42, - 'when `.return` and completionThunk do not throw, and `.return` returns an Object, returns completionThunk' - ); - - t.end(); - }); - - test('ObjectCreate', function (t) { - forEach(v.nonNullPrimitives, function (value) { - t['throws']( - function () { ES.ObjectCreate(value); }, - TypeError, - debug(value) + ' is not null, or an object' - ); - }); - - t.test('proto arg', function (st) { - var Parent = function Parent() {}; - Parent.prototype.foo = {}; - var child = ES.ObjectCreate(Parent.prototype); - st.equal(child instanceof Parent, true, 'child is instanceof Parent'); - st.equal(child.foo, Parent.prototype.foo, 'child inherits properties from Parent.prototype'); - - st.end(); - }); - - t.test('internal slots arg', function (st) { - st.doesNotThrow(function () { ES.ObjectCreate({}, []); }, 'an empty slot list is valid'); - - st['throws']( - function () { ES.ObjectCreate({}, ['a']); }, - SyntaxError, - 'internal slots are not supported' - ); - - st.end(); - }); - - t.test('null proto', { skip: !Object.create && !$setProto }, function (st) { - st.equal('toString' in {}, true, 'normal objects have toString'); - st.equal('toString' in ES.ObjectCreate(null), false, 'makes a null object'); - - st.end(); - }); - - t.test('null proto when no native Object.create', { skip: Object.create || $setProto }, function (st) { - st['throws']( - function () { ES.ObjectCreate(null); }, - SyntaxError, - 'without a native Object.create, can not create null objects' - ); - - st.end(); - }); - - t.end(); - }); - - test('OrdinaryCreateFromConstructor', function (t) { - forEach(v.nonFunctions, function (nonFunction) { - t['throws']( - function () { ES.OrdinaryCreateFromConstructor(nonFunction, '%Array.prototype%'); }, - TypeError, - debug(nonFunction) + ' is not a constructor' - ); - }); - - forEach(arrowFns, function (arrowFn) { - t['throws']( - function () { ES.OrdinaryCreateFromConstructor(arrowFn, '%Array.prototype%'); }, - TypeError, - debug(arrowFn) + ' is not a constructor' - ); - }); - - t.test('proto arg', function (st) { - var Parent = function Parent() {}; - Parent.prototype.foo = {}; - var child = ES.OrdinaryCreateFromConstructor(Parent, '%Array.prototype%'); - st.equal(child instanceof Parent, true, 'child is instanceof Parent'); - st.equal(child instanceof Array, false, 'child is not instanceof Array'); - st.equal(child.foo, Parent.prototype.foo, 'child inherits properties from Parent.prototype'); - - st.end(); - }); - - t.test('internal slots arg', function (st) { - st.doesNotThrow( - function () { ES.OrdinaryCreateFromConstructor(function () {}, '%Array.prototype%', []); }, - 'an empty slot list is valid' - ); - - st['throws']( - function () { ES.OrdinaryCreateFromConstructor(function () {}, '%Array.prototype%', ['a']); }, - SyntaxError, - 'internal slots are not supported' - ); - - st.end(); - }); - - t.end(); - }); - - test('OrdinaryGetOwnProperty', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.OrdinaryGetOwnProperty(primitive, ''); }, - TypeError, - 'O: ' + debug(primitive) + ' is not an Object' - ); - }); - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.OrdinaryGetOwnProperty({}, nonPropertyKey); }, - TypeError, - 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - t.equal(ES.OrdinaryGetOwnProperty({}, 'not in the object'), undefined, 'missing property yields undefined'); - t.equal(ES.OrdinaryGetOwnProperty({}, 'toString'), undefined, 'inherited non-own property yields undefined'); - - t.deepEqual( - ES.OrdinaryGetOwnProperty({ a: 1 }, 'a'), - ES.ToPropertyDescriptor({ - configurable: true, - enumerable: true, - value: 1, - writable: true - }), - 'own assigned data property yields expected descriptor' - ); - - t.deepEqual( - ES.OrdinaryGetOwnProperty(/a/, 'lastIndex'), - ES.ToPropertyDescriptor({ - configurable: false, - enumerable: false, - value: 0, - writable: true - }), - 'regex lastIndex yields expected descriptor' - ); - - t.deepEqual( - ES.OrdinaryGetOwnProperty([], 'length'), - ES.ToPropertyDescriptor({ - configurable: false, - enumerable: false, - value: 0, - writable: true - }), - 'array length yields expected descriptor' - ); - - if (!Object.isFrozen || !Object.isFrozen(Object.prototype)) { - t.deepEqual( - ES.OrdinaryGetOwnProperty(Object.prototype, 'toString'), - ES.ToPropertyDescriptor({ - configurable: true, - enumerable: false, - value: Object.prototype.toString, - writable: true - }), - 'own non-enumerable data property yields expected descriptor' - ); - } - - t.test('ES5+', { skip: !defineProperty.oDP }, function (st) { - var O = {}; - defineProperty(O, 'foo', { - configurable: false, - enumerable: false, - value: O, - writable: true - }); - - st.deepEqual( - ES.OrdinaryGetOwnProperty(O, 'foo'), - ES.ToPropertyDescriptor({ - configurable: false, - enumerable: false, - value: O, - writable: true - }), - 'defined own property yields expected descriptor' - ); - - st.end(); - }); - - t.end(); - }); - - test('OrdinaryDefineOwnProperty', { skip: !getOwnPropertyDescriptor }, function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.OrdinaryDefineOwnProperty(primitive, {}, []); }, - TypeError, - 'O: ' + debug(primitive) + ' is not an Object' - ); - }); - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.OrdinaryDefineOwnProperty({}, nonPropertyKey, v.genericDescriptor()); }, - TypeError, - 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.OrdinaryDefineOwnProperty(primitive, '', v.genericDescriptor()); }, - TypeError, - 'Desc: ' + debug(primitive) + ' is not a Property Descriptor' - ); - }); - - var O = {}; - var P = 'property key'; - var Desc = v.accessorDescriptor(); - t.equal( - ES.OrdinaryDefineOwnProperty(O, P, Desc), - true, - 'operation is successful' - ); - t.deepEqual( - getOwnPropertyDescriptor(O, P), - ES.FromPropertyDescriptor(ES.CompletePropertyDescriptor(Desc)), - 'expected property descriptor is defined' - ); - - t.end(); - }); - - test('OrdinaryHasInstance', function (t) { - forEach(v.nonFunctions, function (nonFunction) { - t.equal(ES.OrdinaryHasInstance(nonFunction, {}), false, debug(nonFunction) + ' is not callable'); - }); - - forEach(v.primitives, function (primitive) { - t.equal(ES.OrdinaryHasInstance(function () {}, primitive), false, debug(primitive) + ' is not an object'); - }); - - var C = function C() {}; - var D = function D() {}; - t.equal(ES.OrdinaryHasInstance(C, new C()), true, 'constructor function has an instance of itself'); - t.equal(ES.OrdinaryHasInstance(C, new D()), false, 'constructor/instance mismatch is false'); - t.equal(ES.OrdinaryHasInstance(D, new C()), false, 'instance/constructor mismatch is false'); - t.equal(ES.OrdinaryHasInstance(C, {}), false, 'plain object is not an instance of a constructor'); - t.equal(ES.OrdinaryHasInstance(Object, {}), true, 'plain object is an instance of Object'); - - t.end(); - }); - - test('OrdinaryHasProperty', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.OrdinaryHasProperty(primitive, ''); }, - TypeError, - debug(primitive) + ' is not an object' - ); - }); - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.OrdinaryHasProperty({}, nonPropertyKey); }, - TypeError, - 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - t.equal(ES.OrdinaryHasProperty({ a: 1 }, 'a'), true, 'own property is true'); - t.equal(ES.OrdinaryHasProperty({}, 'toString'), true, 'inherited property is true'); - t.equal(ES.OrdinaryHasProperty({}, 'nope'), false, 'absent property is false'); - - t.end(); - }); - - test('QuoteJSONString', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.QuoteJSONString(nonString); }, - TypeError, - debug(nonString) + ' is not a String' - ); - }); - - t.equal(ES.QuoteJSONString(''), '""', '"" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('a'), '"a"', '"a" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('"'), '"\\""', '"\\"" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\b'), '"\\b"', '"\\b" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\t'), '"\\t"', '"\\t" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\n'), '"\\n"', '"\\n" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\f'), '"\\f"', '"\\f" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\r'), '"\\r"', '"\\r" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\\'), '"\\\\"', '"\\\\" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\\'), '"\\\\"', '"\\\\" gets properly JSON-quoted'); - t.equal(ES.QuoteJSONString('\u0019'), '"\\u0019"', '"\\u0019" gets properly JSON-quoted'); - - t.end(); - }); - - test('RegExpCreate', function (t) { - forEach(v.nonStrings, function (nonString) { - if (typeof nonString !== 'symbol') { - var p = typeof nonString === 'undefined' ? '' : nonString; - t.equal( - String(ES.RegExpCreate(p, 'g')), - '/' + (String(p) || '(?:)') + '/g', - debug(nonString) + ' becomes `/' + String(p) + '/g`' - ); - } - }); - - t.deepEqual(ES.RegExpCreate(), new RegExp(), 'undefined pattern and flags yields empty regex'); - - t.end(); - }); - - test('RegExpExec', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.RegExpExec(primitive); }, - TypeError, - '"R" argument must be an object; ' + debug(primitive) + ' is not' - ); - }); - - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.RegExpExec({}, nonString); }, - TypeError, - '"S" argument must be a String; ' + debug(nonString) + ' is not' - ); - }); - - t.test('gets and calls a callable "exec"', function (st) { - var str = '123'; - var o = { - exec: function (S) { - st.equal(this, o, '"exec" receiver is R'); - st.equal(S, str, '"exec" argument is S'); - - return null; - } - }; - st.plan(2); - ES.RegExpExec(o, str); - st.end(); - }); - - t.test('throws if a callable "exec" returns a non-null non-object', function (st) { - var str = '123'; - st.plan(v.nonNullPrimitives.length); - forEach(v.nonNullPrimitives, function (nonNullPrimitive) { - st['throws']( - function () { ES.RegExpExec({ exec: function () { return nonNullPrimitive; } }, str); }, - TypeError, - '"exec" method must return `null` or an Object; ' + debug(nonNullPrimitive) + ' is not' - ); - }); - st.end(); - }); - - t.test('actual regex that should match against a string', function (st) { - var S = 'aabc'; - var R = /a/g; - var match1 = ES.RegExpExec(R, S); - var expected1 = assign(['a'], kludgeMatch(R, { index: 0, input: S })); - var match2 = ES.RegExpExec(R, S); - var expected2 = assign(['a'], kludgeMatch(R, { index: 1, input: S })); - var match3 = ES.RegExpExec(R, S); - st.deepEqual(match1, expected1, 'match object 1 is as expected'); - st.deepEqual(match2, expected2, 'match object 2 is as expected'); - st.equal(match3, null, 'match 3 is null as expected'); - st.end(); - }); - - t.test('actual regex that should match against a string, with shadowed "exec"', function (st) { - var S = 'aabc'; - var R = /a/g; - defineProperty(R, 'exec', { value: undefined }); - var match1 = ES.RegExpExec(R, S); - var expected1 = assign(['a'], kludgeMatch(R, { index: 0, input: S })); - var match2 = ES.RegExpExec(R, S); - var expected2 = assign(['a'], kludgeMatch(R, { index: 1, input: S })); - var match3 = ES.RegExpExec(R, S); - st.deepEqual(match1, expected1, 'match object 1 is as expected'); - st.deepEqual(match2, expected2, 'match object 2 is as expected'); - st.equal(match3, null, 'match 3 is null as expected'); - st.end(); - }); - t.end(); - }); - - test('RequireObjectCoercible', function (t) { - t.equal(false, 'CheckObjectCoercible' in ES, 'CheckObjectCoercible -> RequireObjectCoercible in ES6'); - t['throws'](function () { return ES.RequireObjectCoercible(undefined); }, TypeError, 'undefined throws'); - t['throws'](function () { return ES.RequireObjectCoercible(null); }, TypeError, 'null throws'); - var isCoercible = function (value) { - t.doesNotThrow(function () { return ES.RequireObjectCoercible(value); }, debug(value) + ' does not throw'); - }; - forEach(v.objects.concat(v.nonNullPrimitives), isCoercible); - t.end(); - }); - - test('SameValueZero', function (t) { - t.equal(true, ES.SameValueZero(NaN, NaN), 'NaN is SameValueZero as NaN'); - t.equal(true, ES.SameValueZero(0, -0), '+0 is SameValueZero as -0'); - forEach(v.objects.concat(v.primitives), function (val) { - t.equal(val === val, ES.SameValueZero(val, val), debug(val) + ' is SameValueZero to itself'); - }); - t.end(); - }); - - test('Set', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.Set(primitive, '', null, false); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonKey) { - t['throws']( - function () { ES.Set({}, nonKey, null, false); }, - TypeError, - debug(nonKey) + ' is not a Property Key' - ); - }); - - forEach(v.nonBooleans, function (nonBoolean) { - t['throws']( - function () { ES.Set({}, '', null, nonBoolean); }, - TypeError, - debug(nonBoolean) + ' is not a Boolean' - ); - }); - - var o = {}; - var value = {}; - ES.Set(o, 'key', value, true); - t.deepEqual(o, { key: value }, 'key is set'); - - t.test('nonwritable', { skip: !defineProperty.oDP }, function (st) { - var obj = { a: value }; - defineProperty(obj, 'a', { writable: false }); - - st['throws']( - function () { ES.Set(obj, 'a', {}, true); }, - TypeError, - 'can not Set nonwritable property' - ); - - st.doesNotThrow( - function () { - st.equal(ES.Set(obj, 'a', {}, false), false, 'unsuccessful Set returns false'); - }, - 'setting Throw to false prevents an exception' - ); - - st.end(); - }); - - t.test('nonconfigurable', { skip: !defineProperty.oDP }, function (st) { - var obj = { a: value }; - defineProperty(obj, 'a', { configurable: false }); - - st.equal(ES.Set(obj, 'a', value, true), true, 'successful Set returns true'); - st.deepEqual(obj, { a: value }, 'key is set'); - - st.end(); - }); - - t.test('doesn’t call [[Get]] in conforming strict mode environments', { skip: noThrowOnStrictViolation }, function (st) { - var getterCalled = false; - var setterCalls = 0; - var obj = {}; - defineProperty(obj, 'a', { - get: function () { - getterCalled = true; - }, - set: function () { - setterCalls += 1; - } - }); - - st.equal(ES.Set(obj, 'a', value, false), true, 'successful Set returns true'); - st.equal(setterCalls, 1, 'setter was called once'); - st.equal(getterCalled, false, 'getter was not called'); - - st.end(); - }); - - t.end(); - }); - - test('SetFunctionName', function (t) { - forEach(v.nonFunctions, function (nonFunction) { - t['throws']( - function () { ES.SetFunctionName(nonFunction, ''); }, - TypeError, - debug(nonFunction) + ' is not a Function' - ); - }); - - t.test('non-extensible function', { skip: !Object.preventExtensions }, function (st) { - var f = getNamelessFunction(); - Object.preventExtensions(f); - st['throws']( - function () { ES.SetFunctionName(f, ''); }, - TypeError, - 'throws on a non-extensible function' - ); - st.end(); - }); - - t.test('has an own name property', { skip: !functionsHaveNames }, function (st) { - st['throws']( - function () { ES.SetFunctionName(function g() {}, ''); }, - TypeError, - 'throws if function has an own `name` property' - ); - st.end(); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.SetFunctionName(getNamelessFunction(), nonPropertyKey); }, - TypeError, - debug(nonPropertyKey) + ' is not a Symbol or String' - ); - }); - - t.test('symbols', { skip: !v.hasSymbols || has(getNamelessFunction(), 'name') }, function (st) { - var pairs = [ - [Symbol(), ''], - [Symbol(undefined), ''], - [Symbol(null), '[null]'], - [Symbol(''), getInferredName ? '[]' : ''], - [Symbol.iterator, '[Symbol.iterator]'], - [Symbol('foo'), '[foo]'] - ]; - forEach(pairs, function (pair) { - var sym = pair[0]; - var desc = pair[1]; - var f = getNamelessFunction(); - ES.SetFunctionName(f, sym); - st.equal(f.name, desc, debug(sym) + ' yields a name of ' + debug(desc)); - }); - - st.end(); - }); - - var f = getNamelessFunction(); - t.test('when names are configurable', { skip: !functionsHaveConfigurableNames || has(f, 'name') }, function (st) { - // without prefix - st.notEqual(f.name, 'foo', 'precondition'); - ES.SetFunctionName(f, 'foo'); - st.equal(f.name, 'foo', 'function name is set without a prefix'); - - // with prefix - var g = getNamelessFunction(); - st.notEqual(g.name, 'pre- foo', 'precondition'); - ES.SetFunctionName(g, 'foo', 'pre-'); - st.equal(g.name, 'pre- foo', 'function name is set with a prefix'); - - st.end(); - }); - - t.end(); - }); - - test('SetIntegrityLevel', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.SetIntegrityLevel(primitive); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - - t['throws']( - function () { ES.SetIntegrityLevel({}); }, - /^TypeError: Assertion failed: `level` must be `"sealed"` or `"frozen"`$/, - '`level` must be `"sealed"` or `"frozen"`' - ); - - var O = { a: 1 }; - t.test('sealed', { skip: !Object.preventExtensions || noThrowOnStrictViolation }, function (st) { - st.equal(ES.SetIntegrityLevel(O, 'sealed'), true); - st['throws']( - function () { O.b = 2; }, - /^TypeError: (Cannot|Can't) add property b, object is not extensible$/, - 'sealing prevent new properties from being added' - ); - O.a = 2; - st.equal(O.a, 2, 'pre-frozen, existing properties are mutable'); - st.end(); - }); - - t.test('frozen', { skip: !Object.freeze || noThrowOnStrictViolation }, function (st) { - st.equal(ES.SetIntegrityLevel(O, 'frozen'), true); - st['throws']( - function () { O.a = 3; }, - /^TypeError: Cannot assign to read only property 'a' of /, - 'freezing prevents existing properties from being mutated' - ); - st.end(); - }); - - t.end(); - }); - - test('SpeciesConstructor', function (t) { - t['throws'](function () { ES.SpeciesConstructor(null); }, TypeError); - t['throws'](function () { ES.SpeciesConstructor(undefined); }, TypeError); - - var defaultConstructor = function Foo() {}; - - t.equal( - ES.SpeciesConstructor({ constructor: undefined }, defaultConstructor), - defaultConstructor, - 'undefined constructor returns defaultConstructor' - ); - - t['throws']( - function () { return ES.SpeciesConstructor({ constructor: null }, defaultConstructor); }, - TypeError, - 'non-undefined non-object constructor throws' - ); - - t.test('with Symbol.species', { skip: !hasSpecies }, function (st) { - var Bar = function Bar() {}; - Bar[Symbol.species] = null; - - st.equal( - ES.SpeciesConstructor(new Bar(), defaultConstructor), - defaultConstructor, - 'undefined/null Symbol.species returns default constructor' - ); - - var Baz = function Baz() {}; - Baz[Symbol.species] = Bar; - st.equal( - ES.SpeciesConstructor(new Baz(), defaultConstructor), - Bar, - 'returns Symbol.species constructor value' - ); - - Baz[Symbol.species] = {}; - st['throws']( - function () { ES.SpeciesConstructor(new Baz(), defaultConstructor); }, - TypeError, - 'throws when non-constructor non-null non-undefined species value found' - ); - - st.end(); - }); - - t.end(); - }); - - test('SplitMatch', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.SplitMatch(nonString, 0, ''); }, - TypeError, - 'S: ' + debug(nonString) + ' is not a String' - ); - t['throws']( - function () { ES.SplitMatch('', 0, nonString); }, - TypeError, - 'R: ' + debug(nonString) + ' is not a String' - ); - }); - - forEach(v.nonNumbers.concat(v.nonIntegerNumbers), function (nonIntegerNumber) { - t['throws']( - function () { ES.SplitMatch('', nonIntegerNumber, ''); }, - TypeError, - 'q: ' + debug(nonIntegerNumber) + ' is not an integer' - ); - }); - - t.equal(ES.SplitMatch('abc', 0, 'a'), 1, '"a" is found at index 0, before index 1, in "abc"'); - t.equal(ES.SplitMatch('abc', 1, 'a'), false, '"a" is not found at index 1 in "abc"'); - t.equal(ES.SplitMatch('abc', 2, 'a'), false, '"a" is not found at index 2 in "abc"'); - - t.equal(ES.SplitMatch('abc', 0, 'b'), false, '"a" is not found at index 0 in "abc"'); - t.equal(ES.SplitMatch('abc', 1, 'b'), 2, '"b" is found at index 1, before index 2, in "abc"'); - t.equal(ES.SplitMatch('abc', 2, 'b'), false, '"a" is not found at index 2 in "abc"'); - - t.equal(ES.SplitMatch('abc', 0, 'c'), false, '"a" is not found at index 0 in "abc"'); - t.equal(ES.SplitMatch('abc', 1, 'c'), false, '"a" is not found at index 1 in "abc"'); - t.equal(ES.SplitMatch('abc', 2, 'c'), 3, '"c" is found at index 2, before index 3, in "abc"'); - - t.equal(ES.SplitMatch('a', 0, 'ab'), false, 'R longer than S yields false'); - - var s = 'a' + wholePoo + 'c'; - t.equal(ES.SplitMatch(s, 1, wholePoo), 3, debug(wholePoo) + ' is found at index 1, before index 3, in ' + debug(s)); - - t.end(); - }); - - test('StringCreate', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.StringCreate(nonString); }, - TypeError, - debug(nonString) + ' is not a String' - ); - }); - - t.deepEqual(ES.StringCreate('foo', String.prototype), Object('foo'), '"foo" with `String.prototype` makes `Object("foo")'); - - if ($setProto) { - var proto = {}; - t.equal($getProto(ES.StringCreate('', proto)), proto, '[[Prototype]] is set as expected'); - } else { - t['throws']( - function () { ES.StringCreate('', proto); }, - SyntaxError, - 'setting [[Prototype]] is not supported in this env' - ); - } - - t.equal(ES.StringCreate('a', String.prototype).length, 'a'.length, 'length is preserved'); - - t.end(); - }); - - test('StringGetIndexProperty', function (t) { - forEach(v.nonStrings.concat(v.strings), function (nonStringObjects) { - t['throws']( - function () { ES.StringGetIndexProperty(nonStringObjects); }, - TypeError, - debug(nonStringObjects) + ' is not a boxed String Object' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.StringGetIndexProperty('', nonPropertyKey); }, - TypeError, - debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - forEach(v.symbols, function (symbol) { - t.equal( - ES.StringGetIndexProperty(Object('a'), symbol), - undefined, - debug(symbol) + ' is a Property Key, but not a String' - ); - }); - - // a string where CanonicalNumericIndexString returns undefined, a non-integer, or -0 - forEach(['-1', '-0', 'undefined'].concat(v.nonIntegerNumbers), function (nonIndex) { - var S = Object('abc'); - t.equal( - ES.StringGetIndexProperty(S, String(nonIndex)), - undefined, - debug(nonIndex) + ' is not an index inside ' + debug(S) - ); - }); - - forEach(v.strings, function (str) { - var S = Object(str); - for (var i = 0; i < str.length; i += 1) { - var desc = { - '[[Configurable]]': false, - '[[Enumerable]]': true, - '[[Value]]': str.charAt(i), - '[[Writable]]': false - }; - t.deepEqual( - ES.StringGetIndexProperty(S, String(i)), - desc, - 'boxed String ' + debug(S) + ' at index ' + debug(i) + ' is ' + debug(desc) - ); - } - t.equal( - ES.StringGetIndexProperty(S, String(str.length)), - undefined, - 'boxed String ' + debug(S) + ' at OOB index ' + debug(str.length) + ' is `undefined' - ); - }); - - t.end(); - }); - - test('SymbolDescriptiveString', function (t) { - forEach(v.nonSymbolPrimitives.concat(v.objects), function (nonSymbol) { - t['throws']( - function () { ES.SymbolDescriptiveString(nonSymbol); }, - TypeError, - debug(nonSymbol) + ' is not a Symbol' - ); - }); - - t.test('Symbols', { skip: !v.hasSymbols }, function (st) { - st.equal(ES.SymbolDescriptiveString(Symbol()), 'Symbol()', 'undefined description'); - st.equal(ES.SymbolDescriptiveString(Symbol('')), 'Symbol()', 'empty string description'); - st.equal(ES.SymbolDescriptiveString(Symbol.iterator), 'Symbol(Symbol.iterator)', 'well-known symbol'); - st.equal(ES.SymbolDescriptiveString(Symbol('foo')), 'Symbol(foo)', 'string description'); - - st.end(); - }); - - t.end(); - }); - - test('TestIntegrityLevel', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.TestIntegrityLevel(primitive); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - - t['throws']( - function () { ES.TestIntegrityLevel({ a: 1 }); }, - /^TypeError: Assertion failed: `level` must be `"sealed"` or `"frozen"`$/, - '`level` must be `"sealed"` or `"frozen"`' - ); - - t.equal(ES.TestIntegrityLevel({ a: 1 }, 'sealed'), false, 'basic object is not sealed'); - t.equal(ES.TestIntegrityLevel({ a: 1 }, 'frozen'), false, 'basic object is not frozen'); - - t.test('preventExtensions', { skip: !Object.preventExtensions }, function (st) { - var o = Object.preventExtensions({ a: 1 }); - st.equal(ES.TestIntegrityLevel(o, 'sealed'), false, 'nonextensible object is not sealed'); - st.equal(ES.TestIntegrityLevel(o, 'frozen'), false, 'nonextensible object is not frozen'); - - var empty = Object.preventExtensions({}); - st.equal(ES.TestIntegrityLevel(empty, 'sealed'), true, 'empty nonextensible object is sealed'); - st.equal(ES.TestIntegrityLevel(empty, 'frozen'), true, 'empty nonextensible object is frozen'); - st.end(); - }); - - t.test('seal', { skip: !Object.seal }, function (st) { - var o = Object.seal({ a: 1 }); - st.equal(ES.TestIntegrityLevel(o, 'sealed'), true, 'sealed object is sealed'); - st.equal(ES.TestIntegrityLevel(o, 'frozen'), false, 'sealed object is not frozen'); - - var empty = Object.seal({}); - st.equal(ES.TestIntegrityLevel(empty, 'sealed'), true, 'empty sealed object is sealed'); - st.equal(ES.TestIntegrityLevel(empty, 'frozen'), true, 'empty sealed object is frozen'); - - st.end(); - }); - - t.test('freeze', { skip: !Object.freeze }, function (st) { - var o = Object.freeze({ a: 1 }); - st.equal(ES.TestIntegrityLevel(o, 'sealed'), true, 'frozen object is sealed'); - st.equal(ES.TestIntegrityLevel(o, 'frozen'), true, 'frozen object is frozen'); - - var empty = Object.freeze({}); - st.equal(ES.TestIntegrityLevel(empty, 'sealed'), true, 'empty frozen object is sealed'); - st.equal(ES.TestIntegrityLevel(empty, 'frozen'), true, 'empty frozen object is frozen'); - - st.end(); - }); - - t.end(); - }); - - test('thisNumberValue', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.thisNumberValue(nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a Number' - ); - }); - - forEach(v.numbers, function (number) { - t.equal(ES.thisNumberValue(number), number, debug(number) + ' is its own thisNumberValue'); - var obj = Object(number); - t.equal(ES.thisNumberValue(obj), number, debug(obj) + ' is the boxed thisNumberValue'); - }); - - t.end(); - }); - - test('thisBooleanValue', function (t) { - forEach(v.nonBooleans, function (nonBoolean) { - t['throws']( - function () { ES.thisBooleanValue(nonBoolean); }, - TypeError, - debug(nonBoolean) + ' is not a Boolean' - ); - }); - - forEach(v.booleans, function (boolean) { - t.equal(ES.thisBooleanValue(boolean), boolean, debug(boolean) + ' is its own thisBooleanValue'); - var obj = Object(boolean); - t.equal(ES.thisBooleanValue(obj), boolean, debug(obj) + ' is the boxed thisBooleanValue'); - }); - - t.end(); - }); - - test('thisStringValue', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.thisStringValue(nonString); }, - TypeError, - debug(nonString) + ' is not a String' - ); - }); - - forEach(v.strings, function (string) { - t.equal(ES.thisStringValue(string), string, debug(string) + ' is its own thisStringValue'); - var obj = Object(string); - t.equal(ES.thisStringValue(obj), string, debug(obj) + ' is the boxed thisStringValue'); - }); - - t.end(); - }); - - test('thisTimeValue', function (t) { - forEach(v.primitives.concat(v.objects), function (nonDate) { - t['throws']( - function () { ES.thisTimeValue(nonDate); }, - TypeError, - debug(nonDate) + ' is not a Date' - ); - }); - - forEach(v.timestamps, function (timestamp) { - var date = new Date(timestamp); - - t.equal(ES.thisTimeValue(date), timestamp, debug(date) + ' is its own thisTimeValue'); - }); - - t.end(); - }); - - test('ToDateString', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.ToDateString(nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.ToDateString(NaN), 'Invalid Date', 'NaN becomes "Invalid Date"'); - var now = +new Date(); - t.equal(ES.ToDateString(now), Date(now), 'any timestamp becomes `Date(timestamp)`'); - t.end(); - }); - - test('ToInt16', function (t) { - t.equal(0, ES.ToInt16(NaN), 'NaN coerces to +0'); - forEach([0, Infinity], function (num) { - t.equal(0, ES.ToInt16(num), num + ' returns +0'); - t.equal(0, ES.ToInt16(-num), '-' + num + ' returns +0'); - }); - t['throws'](function () { return ES.ToInt16(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.equal(ES.ToInt16(0x100000000), 0, '2^32 returns +0'); - t.equal(ES.ToInt16(0x100000000 - 1), -1, '2^32 - 1 returns -1'); - t.equal(ES.ToInt16(0x80000000), 0, '2^31 returns +0'); - t.equal(ES.ToInt16(0x80000000 - 1), -1, '2^31 - 1 returns -1'); - t.equal(ES.ToInt16(0x10000), 0, '2^16 returns +0'); - t.equal(ES.ToInt16(0x10000 - 1), -1, '2^16 - 1 returns -1'); - t.end(); - }); - - test('ToInt8', function (t) { - t.equal(0, ES.ToInt8(NaN), 'NaN coerces to +0'); - forEach([0, Infinity], function (num) { - t.equal(0, ES.ToInt8(num), num + ' returns +0'); - t.equal(0, ES.ToInt8(-num), '-' + num + ' returns +0'); - }); - t['throws'](function () { return ES.ToInt8(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.equal(ES.ToInt8(0x100000000), 0, '2^32 returns +0'); - t.equal(ES.ToInt8(0x100000000 - 1), -1, '2^32 - 1 returns -1'); - t.equal(ES.ToInt8(0x80000000), 0, '2^31 returns +0'); - t.equal(ES.ToInt8(0x80000000 - 1), -1, '2^31 - 1 returns -1'); - t.equal(ES.ToInt8(0x10000), 0, '2^16 returns +0'); - t.equal(ES.ToInt8(0x10000 - 1), -1, '2^16 - 1 returns -1'); - t.equal(ES.ToInt8(0x100), 0, '2^8 returns +0'); - t.equal(ES.ToInt8(0x100 - 1), -1, '2^8 - 1 returns -1'); - t.equal(ES.ToInt8(0x10), 0x10, '2^4 returns 2^4'); - t.end(); - }); - - test('ToNumber', function (t) { - testToNumber(t, ES, ES.ToNumber); - - t.end(); - }); - - test('ToUint8', function (t) { - t.equal(0, ES.ToUint8(NaN), 'NaN coerces to +0'); - forEach([0, Infinity], function (num) { - t.equal(0, ES.ToUint8(num), num + ' returns +0'); - t.equal(0, ES.ToUint8(-num), '-' + num + ' returns +0'); - }); - t['throws'](function () { return ES.ToUint8(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.equal(ES.ToUint8(0x100000000), 0, '2^32 returns +0'); - t.equal(ES.ToUint8(0x100000000 - 1), 0x100 - 1, '2^32 - 1 returns 2^8 - 1'); - t.equal(ES.ToUint8(0x80000000), 0, '2^31 returns +0'); - t.equal(ES.ToUint8(0x80000000 - 1), 0x100 - 1, '2^31 - 1 returns 2^8 - 1'); - t.equal(ES.ToUint8(0x10000), 0, '2^16 returns +0'); - t.equal(ES.ToUint8(0x10000 - 1), 0x100 - 1, '2^16 - 1 returns 2^8 - 1'); - t.equal(ES.ToUint8(0x100), 0, '2^8 returns +0'); - t.equal(ES.ToUint8(0x100 - 1), 0x100 - 1, '2^8 - 1 returns 2^16 - 1'); - t.equal(ES.ToUint8(0x10), 0x10, '2^4 returns 2^4'); - t.equal(ES.ToUint8(0x10 - 1), 0x10 - 1, '2^4 - 1 returns 2^4 - 1'); - t.end(); - }); - - test('ToUint8Clamp', function (t) { - t.equal(0, ES.ToUint8Clamp(NaN), 'NaN coerces to +0'); - t.equal(0, ES.ToUint8Clamp(0), '+0 returns +0'); - t.equal(0, ES.ToUint8Clamp(-0), '-0 returns +0'); - t.equal(0, ES.ToUint8Clamp(-Infinity), '-Infinity returns +0'); - t['throws'](function () { return ES.ToUint8Clamp(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - forEach([255, 256, 0x100000, Infinity], function (number) { - t.equal(255, ES.ToUint8Clamp(number), number + ' coerces to 255'); - }); - t.equal(1, ES.ToUint8Clamp(1.49), '1.49 coerces to 1'); - t.equal(2, ES.ToUint8Clamp(1.5), '1.5 coerces to 2, because 2 is even'); - t.equal(2, ES.ToUint8Clamp(1.51), '1.51 coerces to 2'); - - t.equal(2, ES.ToUint8Clamp(2.49), '2.49 coerces to 2'); - t.equal(2, ES.ToUint8Clamp(2.5), '2.5 coerces to 2, because 2 is even'); - t.equal(3, ES.ToUint8Clamp(2.51), '2.51 coerces to 3'); - t.end(); - }); - - test('ToLength', function (t) { - t['throws'](function () { return ES.ToLength(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws a TypeError'); - t.equal(3, ES.ToLength(v.coercibleObject), 'coercibleObject coerces to 3'); - t.equal(42, ES.ToLength('42.5'), '"42.5" coerces to 42'); - t.equal(7, ES.ToLength(7.3), '7.3 coerces to 7'); - forEach([-0, -1, -42, -Infinity], function (negative) { - t.equal(0, ES.ToLength(negative), negative + ' coerces to +0'); - }); - t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 1), '2^53 coerces to 2^53 - 1'); - t.equal(MAX_SAFE_INTEGER, ES.ToLength(MAX_SAFE_INTEGER + 3), '2^53 + 2 coerces to 2^53 - 1'); - t.end(); - }); - - test('ToPropertyKey', function (t) { - forEach(v.objects.concat(v.nonSymbolPrimitives), function (value) { - t.equal(ES.ToPropertyKey(value), String(value), 'ToPropertyKey(value) === String(value) for non-Symbols'); - }); - - forEach(v.symbols, function (symbol) { - t.equal( - ES.ToPropertyKey(symbol), - symbol, - 'ToPropertyKey(' + debug(symbol) + ') === ' + debug(symbol) - ); - t.equal( - ES.ToPropertyKey(Object(symbol)), - symbol, - 'ToPropertyKey(' + debug(Object(symbol)) + ') === ' + debug(symbol) - ); - }); - - t.end(); - }); - - test('ToString', function (t) { - forEach(v.objects.concat(v.nonSymbolPrimitives), function (item) { - t.equal(ES.ToString(item), String(item), 'ES.ToString(' + debug(item) + ') ToStrings to String(' + debug(item) + ')'); - }); - - t['throws'](function () { return ES.ToString(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - - forEach(v.symbols, function (symbol) { - t['throws'](function () { return ES.ToString(symbol); }, TypeError, debug(symbol) + ' throws'); - }); - t.end(); - }); - - test('Type', function (t) { - t.equal(ES.Type(), 'Undefined', 'Type() is Undefined'); - t.equal(ES.Type(undefined), 'Undefined', 'Type(undefined) is Undefined'); - t.equal(ES.Type(null), 'Null', 'Type(null) is Null'); - t.equal(ES.Type(true), 'Boolean', 'Type(true) is Boolean'); - t.equal(ES.Type(false), 'Boolean', 'Type(false) is Boolean'); - t.equal(ES.Type(0), 'Number', 'Type(0) is Number'); - t.equal(ES.Type(NaN), 'Number', 'Type(NaN) is Number'); - t.equal(ES.Type('abc'), 'String', 'Type("abc") is String'); - t.equal(ES.Type(function () {}), 'Object', 'Type(function () {}) is Object'); - t.equal(ES.Type({}), 'Object', 'Type({}) is Object'); - - t.test('symbols', { skip: !v.hasSymbols }, function (st) { - st.equal(ES.Type(Symbol.iterator), 'Symbol', 'Type(Symbol.iterator) is Symbol'); - st.end(); - }); - - t.end(); - }); - - test('ValidateAndApplyPropertyDescriptor', function (t) { - forEach(v.nonUndefinedPrimitives, function (nonUndefinedPrimitive) { - t['throws']( - function () { ES.ValidateAndApplyPropertyDescriptor(nonUndefinedPrimitive, '', false, v.genericDescriptor(), v.genericDescriptor()); }, - TypeError, - 'O: ' + debug(nonUndefinedPrimitive) + ' is not undefined or an Object' - ); - }); - - forEach(v.nonBooleans, function (nonBoolean) { - t['throws']( - function () { - return ES.ValidateAndApplyPropertyDescriptor( - undefined, - null, - nonBoolean, - v.genericDescriptor(), - v.genericDescriptor() - ); - }, - TypeError, - 'extensible: ' + debug(nonBoolean) + ' is not a Boolean' - ); - }); - - forEach(v.primitives, function (primitive) { - // Desc must be a Property Descriptor - t['throws']( - function () { - return ES.ValidateAndApplyPropertyDescriptor( - undefined, - null, - false, - primitive, - v.genericDescriptor() - ); - }, - TypeError, - 'Desc: ' + debug(primitive) + ' is not a Property Descriptor' - ); - }); - - forEach(v.nonUndefinedPrimitives, function (primitive) { - // current must be undefined or a Property Descriptor - t['throws']( - function () { - return ES.ValidateAndApplyPropertyDescriptor( - undefined, - null, - false, - v.genericDescriptor(), - primitive - ); - }, - TypeError, - 'current: ' + debug(primitive) + ' is not a Property Descriptor or undefined' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - // if O is an object, P must be a property key - t['throws']( - function () { - return ES.ValidateAndApplyPropertyDescriptor( - {}, - nonPropertyKey, - false, - v.genericDescriptor(), - v.genericDescriptor() - ); - }, - TypeError, - 'P: ' + debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - t.test('current is undefined', function (st) { - var propertyKey = 'howdy'; - - st.test('generic descriptor', function (s2t) { - var generic = v.genericDescriptor(); - generic['[[Enumerable]]'] = true; - var O = {}; - ES.ValidateAndApplyPropertyDescriptor(undefined, propertyKey, true, generic); - s2t.equal( - ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, false, generic), - false, - 'when extensible is false, nothing happens' - ); - s2t.deepEqual(O, {}, 'no changes applied when O is undefined or extensible is false'); - s2t.equal( - ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, true, generic), - true, - 'operation is successful' - ); - var expected = {}; - expected[propertyKey] = undefined; - s2t.deepEqual(O, expected, 'generic descriptor has been defined as an own data property'); - s2t.end(); - }); - - st.test('data descriptor', function (s2t) { - var data = v.dataDescriptor(); - data['[[Enumerable]]'] = true; - - var O = {}; - s2t.equal( - ES.ValidateAndApplyPropertyDescriptor(undefined, propertyKey, true, data), - true, - 'noop when O is undefined' - ); - s2t.equal( - ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, false, data), - false, - 'when extensible is false, nothing happens' - ); - s2t.deepEqual(O, {}, 'no changes applied when O is undefined or extensible is false'); - s2t.equal( - ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, true, data), - true, - 'operation is successful' - ); - var expected = {}; - expected[propertyKey] = data['[[Value]]']; - s2t.deepEqual(O, expected, 'data descriptor has been defined as an own data property'); - s2t.end(); - }); - - st.test('accessor descriptor', { skip: !defineProperty.oDP }, function (s2t) { - var count = 0; - var accessor = v.accessorDescriptor(); - accessor['[[Enumerable]]'] = true; - accessor['[[Get]]'] = function () { - count += 1; - return count; - }; - - var O = {}; - ES.ValidateAndApplyPropertyDescriptor(undefined, propertyKey, true, accessor); - s2t.equal( - ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, false, accessor), - false, - 'when extensible is false, nothing happens' - ); - s2t.deepEqual(O, {}, 'no changes applied when O is undefined or extensible is false'); - s2t.equal( - ES.ValidateAndApplyPropertyDescriptor(O, propertyKey, true, accessor), - true, - 'operation is successful' - ); - var expected = {}; - expected[propertyKey] = accessor['[[Get]]']() + 1; - s2t.deepEqual(O, expected, 'accessor descriptor has been defined as an own accessor property'); - s2t.end(); - }); - - st.end(); - }); - - t.test('every field in Desc is absent', { skip: 'it is unclear if having no fields qualifies Desc to be a Property Descriptor' }); - - forEach([v.dataDescriptor, v.accessorDescriptor, v.mutatorDescriptor], function (getDescriptor) { - t.equal( - ES.ValidateAndApplyPropertyDescriptor(undefined, 'property key', true, getDescriptor(), getDescriptor()), - true, - 'when Desc and current are the same, early return true' - ); - }); - - t.test('current is nonconfigurable', function (st) { - // note: these must not be generic descriptors, or else the algorithm returns an early true - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.descriptors.configurable(v.dataDescriptor()), - v.descriptors.nonConfigurable(v.dataDescriptor()) - ), - false, - 'false if Desc is configurable' - ); - - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.descriptors.enumerable(v.dataDescriptor()), - v.descriptors.nonEnumerable(v.dataDescriptor()) - ), - false, - 'false if Desc is Enumerable and current is not' - ); - - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.descriptors.nonEnumerable(v.dataDescriptor()), - v.descriptors.enumerable(v.dataDescriptor()) - ), - false, - 'false if Desc is not Enumerable and current is' - ); - - var descLackingEnumerable = v.accessorDescriptor(); - delete descLackingEnumerable['[[Enumerable]]']; - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - descLackingEnumerable, - v.descriptors.enumerable(v.accessorDescriptor()) - ), - true, - 'not false if Desc lacks Enumerable' - ); - - st.end(); - }); - - t.test('Desc and current: one is a data descriptor, one is not', { skip: !defineProperty || !getOwnPropertyDescriptor }, function (st) { - // note: Desc must be configurable if current is nonconfigurable, to hit this branch - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.descriptors.configurable(v.accessorDescriptor()), - v.descriptors.nonConfigurable(v.dataDescriptor()) - ), - false, - 'false if current (data) is nonconfigurable' - ); - - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.descriptors.configurable(v.dataDescriptor()), - v.descriptors.nonConfigurable(v.accessorDescriptor()) - ), - false, - 'false if current (not data) is nonconfigurable' - ); - - // one is data and one is not, - // // if current is data, convert to accessor - // // else convert to data - - var startsWithData = { - 'property key': 42 - }; - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - startsWithData, - 'property key', - true, - v.descriptors.enumerable(v.descriptors.configurable(v.accessorDescriptor())), - v.descriptors.enumerable(v.descriptors.configurable(v.dataDescriptor())) - ), - true, - 'operation is successful: current is data, Desc is accessor' - ); - var shouldBeAccessor = getOwnPropertyDescriptor(startsWithData, 'property key'); - st.equal(typeof shouldBeAccessor.get, 'function', 'has a getter'); - - var key = 'property key'; - var startsWithAccessor = {}; - defineProperty(startsWithAccessor, key, { - configurable: true, - enumerable: true, - get: function get() { return 42; } - }); - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - startsWithAccessor, - key, - true, - v.descriptors.enumerable(v.descriptors.configurable(v.dataDescriptor())), - v.descriptors.enumerable(v.descriptors.configurable(v.accessorDescriptor(42))) - ), - true, - 'operation is successful: current is accessor, Desc is data' - ); - var shouldBeData = getOwnPropertyDescriptor(startsWithAccessor, 'property key'); - st.deepEqual(shouldBeData, { configurable: true, enumerable: true, value: 42, writable: false }, 'is a data property'); - - st.end(); - }); - - t.test('Desc and current are both data descriptors', function (st) { - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.descriptors.writable(v.dataDescriptor()), - v.descriptors.nonWritable(v.descriptors.nonConfigurable(v.dataDescriptor())) - ), - false, - 'false if frozen current and writable Desc' - ); - - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.descriptors.configurable({ '[[Value]]': 42 }), - v.descriptors.nonWritable({ '[[Value]]': 7 }) - ), - false, - 'false if nonwritable current has a different value than Desc' - ); - - st.end(); - }); - - t.test('current is nonconfigurable; Desc and current are both accessor descriptors', function (st) { - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.mutatorDescriptor(), - v.descriptors.nonConfigurable(v.mutatorDescriptor()) - ), - false, - 'false if both Sets are not equal' - ); - - st.equal( - ES.ValidateAndApplyPropertyDescriptor( - undefined, - 'property key', - true, - v.accessorDescriptor(), - v.descriptors.nonConfigurable(v.accessorDescriptor()) - ), - false, - 'false if both Gets are not equal' - ); - - st.end(); - }); - - t.end(); - }); -}; - -var es2016 = function ES2016(ES, ops, expectedMissing, skips) { - es2015(ES, ops, expectedMissing, assign(assign({}, skips), { - StringGetIndexProperty: true - })); - var test = makeTest(skips); - - test('IterableToArrayLike', function (t) { - t.test('custom iterables', { skip: !v.hasSymbols }, function (st) { - var O = {}; - O[Symbol.iterator] = function () { - var i = -1; - return { - next: function () { - i += 1; - return { - done: i >= 5, - value: i - }; - } - }; - }; - st.deepEqual( - ES.IterableToArrayLike(O), - [0, 1, 2, 3, 4], - 'Symbol.iterator method is called and values collected' - ); - - st.end(); - }); - - t.deepEqual(ES.IterableToArrayLike('abc'), ['a', 'b', 'c'], 'a string of code units spreads'); - t.deepEqual(ES.IterableToArrayLike('💩'), ['💩'], 'a string of code points spreads'); - t.deepEqual(ES.IterableToArrayLike('a💩c'), ['a', '💩', 'c'], 'a string of code points and units spreads'); - - var arr = [1, 2, 3]; - t.deepEqual(ES.IterableToArrayLike(arr), arr, 'an array becomes a similar array'); - t.notEqual(ES.IterableToArrayLike(arr), arr, 'an array becomes a different, but similar, array'); - - var O = {}; - t.equal(ES.IterableToArrayLike(O), O, 'a non-iterable non-array non-string object is returned directly'); - - t.end(); - }); - - test('OrdinaryGetPrototypeOf', function (t) { - t.test('values', { skip: !$getProto }, function (st) { - st.equal(ES.OrdinaryGetPrototypeOf([]), Array.prototype, 'array [[Prototype]] is Array.prototype'); - st.equal(ES.OrdinaryGetPrototypeOf({}), Object.prototype, 'object [[Prototype]] is Object.prototype'); - st.equal(ES.OrdinaryGetPrototypeOf(/a/g), RegExp.prototype, 'regex [[Prototype]] is RegExp.prototype'); - st.equal(ES.OrdinaryGetPrototypeOf(Object('')), String.prototype, 'boxed string [[Prototype]] is String.prototype'); - st.equal(ES.OrdinaryGetPrototypeOf(Object(42)), Number.prototype, 'boxed number [[Prototype]] is Number.prototype'); - st.equal(ES.OrdinaryGetPrototypeOf(Object(true)), Boolean.prototype, 'boxed boolean [[Prototype]] is Boolean.prototype'); - if (v.hasSymbols) { - st.equal(ES.OrdinaryGetPrototypeOf(Object(Symbol.iterator)), Symbol.prototype, 'boxed symbol [[Prototype]] is Symbol.prototype'); - } - st.end(); - }); - - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.OrdinaryGetPrototypeOf(primitive); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - t.end(); - }); - - test('OrdinarySetPrototypeOf', { skip: !$getProto || !$setProto }, function (t) { - var a = []; - var proto = {}; - - t.equal(ES.OrdinaryGetPrototypeOf(a), Array.prototype, 'precondition'); - t.equal(ES.OrdinarySetPrototypeOf(a, proto), true, 'setting prototype is successful'); - t.equal(ES.OrdinaryGetPrototypeOf(a), proto, 'postcondition'); - - t.end(); - }); - - test('SameValueNonNumber', function (t) { - var willThrow = [ - [3, 4], - [NaN, 4], - [4, ''], - ['abc', true], - [{}, false] - ]; - forEach(willThrow, function (nums) { - t['throws'](function () { return ES.SameValueNonNumber.apply(ES, nums); }, TypeError, 'value must be same type and non-number'); - }); - - forEach(v.objects.concat(v.nonNumberPrimitives), function (val) { - t.equal(val === val, ES.SameValueNonNumber(val, val), debug(val) + ' is SameValueNonNumber to itself'); - }); - - t.end(); - }); - - test('UTF16Encoding', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.UTF16Encoding(nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a Number' - ); - }); - - t['throws']( - function () { ES.UTF16Encoding(-1); }, - TypeError, - '-1 is < 0' - ); - - t['throws']( - function () { ES.UTF16Encoding(0x10FFFF + 1); }, - TypeError, - '0x10FFFF + 1 is > 0x10FFFF' - ); - - t.equal(ES.UTF16Encoding(0xD83D), leadingPoo, '0xD83D is the first half of ' + wholePoo); - t.equal(ES.UTF16Encoding(0xDCA9), trailingPoo, '0xDCA9 is the last half of ' + wholePoo); - t.equal(ES.UTF16Encoding(0x1F4A9), wholePoo, '0xDCA9 is the last half of ' + wholePoo); - - t.end(); - }); - - test('UTF16Decode', function (t) { - t['throws']( - function () { ES.UTF16Decode('a'.charCodeAt(0), trailingPoo.charCodeAt(0)); }, - TypeError, - '"a" is not a leading surrogate' - ); - t['throws']( - function () { ES.UTF16Decode(leadingPoo.charCodeAt(0), 'b'.charCodeAt(0)); }, - TypeError, - '"b" is not a trailing surrogate' - ); - - t.equal(ES.UTF16Decode(leadingPoo.charCodeAt(0), trailingPoo.charCodeAt(0)), wholePoo); - - t.end(); - }); -}; - -var es2017 = function ES2017(ES, ops, expectedMissing, skips) { - es2016(ES, ops, expectedMissing, assign({}, skips, { - EnumerableOwnNames: true, - IterableToArrayLike: true - })); - var test = makeTest(skips); - - test('EnumerableOwnProperties', function (t) { - var obj = testEnumerableOwnNames(t, function (O) { - return ES.EnumerableOwnProperties(O, 'key'); - }); - - t.deepEqual( - ES.EnumerableOwnProperties(obj, 'value'), - [obj.own], - 'returns enumerable own values' - ); - - t.deepEqual( - ES.EnumerableOwnProperties(obj, 'key+value'), - [['own', obj.own]], - 'returns enumerable own entries' - ); - - t.end(); - }); - - test('IterableToList', function (t) { - var customIterator = function () { - var i = -1; - return { - next: function () { - i += 1; - return { - done: i >= 5, - value: i - }; - } - }; - }; - - t.deepEqual( - ES.IterableToList({}, customIterator), - [0, 1, 2, 3, 4], - 'iterator method is called and values collected' - ); - - t.test('Symbol support', { skip: !v.hasSymbols }, function (st) { - st.deepEqual(ES.IterableToList('abc', String.prototype[Symbol.iterator]), ['a', 'b', 'c'], 'a string of code units spreads'); - st.deepEqual(ES.IterableToList('☃', String.prototype[Symbol.iterator]), ['☃'], 'a string of code points spreads'); - - var arr = [1, 2, 3]; - st.deepEqual(ES.IterableToList(arr, arr[Symbol.iterator]), arr, 'an array becomes a similar array'); - st.notEqual(ES.IterableToList(arr, arr[Symbol.iterator]), arr, 'an array becomes a different, but similar, array'); - - st.end(); - }); - - t['throws']( - function () { ES.IterableToList({}, void 0); }, - TypeError, - 'non-function iterator method' - ); - - t.end(); - }); - - test('StringGetOwnProperty', function (t) { - forEach(v.nonStrings.concat(v.strings), function (nonBoxedString) { - t['throws']( - function () { ES.StringGetOwnProperty(nonBoxedString, '0'); }, - TypeError, - debug(nonBoxedString) + ' is not a boxed String' - ); - }); - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - t['throws']( - function () { ES.StringGetOwnProperty(Object(''), nonPropertyKey); }, - TypeError, - debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - t.equal(ES.StringGetOwnProperty(Object(''), '0'), undefined, 'empty boxed string yields undefined'); - - forEach(v.strings, function (string) { - if (string) { - var S = Object(string); - for (var i = 0; i < string.length; i += 1) { - var descriptor = ES.StringGetOwnProperty(S, String(i)); - t.deepEqual( - descriptor, - { - '[[Configurable]]': false, - '[[Enumerable]]': true, - '[[Value]]': string.charAt(i), - '[[Writable]]': false - }, - debug(string) + ': property ' + debug(String(i)) + ': returns expected descriptor' - ); - } - } - }); - - t.end(); - }); - - test('ToIndex', function (t) { - t.equal(ES.ToIndex(), 0, 'no value gives +0'); - t.equal(ES.ToIndex(undefined), 0, 'undefined value gives +0'); - t.equal(ES.ToIndex(-0), 0, '-0 gives +0'); - - t['throws'](function () { ES.ToIndex(-1); }, RangeError, 'negative numbers throw'); - - t['throws'](function () { ES.ToIndex(MAX_SAFE_INTEGER + 1); }, RangeError, 'too large numbers throw'); - - t.equal(ES.ToIndex(3), 3, 'numbers work'); - t.equal(ES.ToIndex(v.valueOfOnlyObject), 4, 'coercible objects are coerced'); - - t.end(); - }); -}; - -var es2018 = function ES2018(ES, ops, expectedMissing, skips) { - es2017(ES, ops, expectedMissing, assign({}, skips, { - EnumerableOwnProperties: true, - GetSubstitution: true, - IsPropertyDescriptor: true - })); - var test = makeTest(skips); - - test('CopyDataProperties', function (t) { - t.test('first argument: target', function (st) { - forEach(v.primitives, function (primitive) { - st['throws']( - function () { ES.CopyDataProperties(primitive, {}, []); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - st.end(); - }); - - t.test('second argument: source', function (st) { - var frozenTarget = Object.freeze ? Object.freeze({}) : {}; - forEach(v.nullPrimitives, function (nullish) { - st.equal( - ES.CopyDataProperties(frozenTarget, nullish, []), - frozenTarget, - debug(nullish) + ' "source" yields identical, unmodified target' - ); - }); - - forEach(v.nonNullPrimitives, function (objectCoercible) { - var target = {}; - var result = ES.CopyDataProperties(target, objectCoercible, []); - st.equal(result, target, 'result === target'); - st.deepEqual(keys(result), keys(Object(objectCoercible)), 'target ends up with keys of ' + debug(objectCoercible)); - }); - - st.test('enumerable accessor property', { skip: !defineProperty.oDP }, function (s2t) { - var target = {}; - var source = {}; - defineProperty(source, 'a', { - enumerable: true, - get: function () { return 42; } - }); - var result = ES.CopyDataProperties(target, source, []); - s2t.equal(result, target, 'result === target'); - s2t.deepEqual(result, { a: 42 }, 'target ends up with enumerable accessor of source'); - s2t.end(); - }); - - st.end(); - }); - - t.test('third argument: excludedItems', function (st) { - forEach(v.objects.concat(v.primitives), function (nonArray) { - st['throws']( - function () { ES.CopyDataProperties({}, {}, nonArray); }, - TypeError, - debug(nonArray) + ' is not an Array' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - st['throws']( - function () { ES.CopyDataProperties({}, {}, [nonPropertyKey]); }, - TypeError, - debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - var result = ES.CopyDataProperties({}, { a: 1, b: 2, c: 3 }, ['b']); - st.deepEqual(keys(result).sort(), ['a', 'c'].sort(), 'excluded string keys are excluded'); - - st.test('excluding symbols', { skip: !v.hasSymbols }, function (s2t) { - var source = {}; - forEach(v.symbols, function (symbol) { - source[symbol] = true; - }); - - var includedSymbols = v.symbols.slice(1); - var excludedSymbols = v.symbols.slice(0, 1); - var target = ES.CopyDataProperties({}, source, excludedSymbols); - - forEach(includedSymbols, function (symbol) { - s2t.equal(has(target, symbol), true, debug(symbol) + ' is included'); - }); - - forEach(excludedSymbols, function (symbol) { - s2t.equal(has(target, symbol), false, debug(symbol) + ' is excluded'); - }); - - s2t.end(); - }); - - st.end(); - }); - - // TODO: CopyDataProperties does not throw when copying fails - - t.end(); - }); - - test('DateString', function (t) { - forEach(v.nonNumbers.concat(NaN), function (nonNumberOrNaN) { - t['throws']( - function () { ES.DateString(nonNumberOrNaN); }, - TypeError, - debug(nonNumberOrNaN) + ' is not a non-NaN Number' - ); - }); - - t.equal(ES.DateString(Date.UTC(2019, 8, 10, 7, 8, 9)), 'Tue Sep 10 2019'); - t.equal(ES.DateString(Date.UTC(2016, 1, 29, 7, 8, 9)), 'Mon Feb 29 2016'); // leap day - t.end(); - }); - - test('EnumerableOwnPropertyNames', function (t) { - var obj = testEnumerableOwnNames(t, function (O) { - return ES.EnumerableOwnPropertyNames(O, 'key'); - }); - - t.deepEqual( - ES.EnumerableOwnPropertyNames(obj, 'value'), - [obj.own], - 'returns enumerable own values' - ); - - t.deepEqual( - ES.EnumerableOwnPropertyNames(obj, 'key+value'), - [['own', obj.own]], - 'returns enumerable own entries' - ); - - t.end(); - }); - - test('GetSubstitution', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.GetSubstitution(nonString, '', 0, [], undefined, ''); }, - TypeError, - '`matched`: ' + debug(nonString) + ' is not a String' - ); - - t['throws']( - function () { ES.GetSubstitution('', nonString, 0, [], undefined, ''); }, - TypeError, - '`str`: ' + debug(nonString) + ' is not a String' - ); - - t['throws']( - function () { ES.GetSubstitution('', '', 0, [], undefined, nonString); }, - TypeError, - '`replacement`: ' + debug(nonString) + ' is not a String' - ); - - t['throws']( - function () { ES.GetSubstitution('', '', 0, [nonString], undefined, ''); }, - TypeError, - '`captures`: ' + debug([nonString]) + ' is not an Array of strings' - ); - }); - - forEach(v.notNonNegativeIntegers, function (nonNonNegativeInteger) { - t['throws']( - function () { ES.GetSubstitution('', '', nonNonNegativeInteger, [], undefined, ''); }, - TypeError, - '`position`: ' + debug(nonNonNegativeInteger) + ' is not a non-negative integer' - ); - }); - - forEach(v.nonArrays, function (nonArray) { - t['throws']( - function () { ES.GetSubstitution('', '', 0, nonArray, undefined, ''); }, - TypeError, - '`captures`: ' + debug(nonArray) + ' is not an Array' - ); - }); - - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 3, [], undefined, '123'), - '123', - 'returns the substitution' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '$$2$'), - '$2$', - 'supports $$, and trailing $' - ); - - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$&<'), - '>abcdef<', - 'supports $&' - ); - - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$`<'), - '><', - 'supports $` at position 0' - ); - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 3, [], undefined, '>$`<'), - '>ab<', - 'supports $` at position > 0' - ); - - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 7, [], undefined, ">$'<"), - '><', - "supports $' at a position where there's less than `matched.length` chars left" - ); - t.equal( - ES.GetSubstitution('def', 'abcdefghi', 3, [], undefined, ">$'<"), - '>ghi<', - "supports $' at a position where there's more than `matched.length` chars left" - ); - - for (var i = 0; i < 100; i += 1) { - var captures = []; - captures[i] = 'test'; - if (i > 0) { - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$' + i + '<'), - '>undefined<', - 'supports $' + i + ' with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$' + i), - '>undefined', - 'supports $' + i + ' at the end of the replacement, with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$' + i + '<'), - '><', - 'supports $' + i + ' with a capture at that index' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$' + i), - '>', - 'supports $' + i + ' at the end of the replacement, with a capture at that index' - ); - } - if (i < 10) { - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$0' + i + '<'), - i === 0 ? '><' : '>undefined<', - 'supports $0' + i + ' with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, [], undefined, '>$0' + i), - i === 0 ? '>' : '>undefined', - 'supports $0' + i + ' at the end of the replacement, with no captures' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$0' + i + '<'), - '><', - 'supports $0' + i + ' with a capture at that index' - ); - t.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, undefined, '>$0' + i), - '>', - 'supports $0' + i + ' at the end of the replacement, with a capture at that index' - ); - } - } - - t.test('named captures', function (st) { - var namedCaptures = { - foo: 'foo!' - }; - - st.equal( - ES.GetSubstitution('abcdef', 'abcdefghi', 0, captures, namedCaptures, 'a>$foo!> bitsN, - debug(bigInt32) + ' >> ' + debug(bitsN) + ' is ' + debug(bigInt32 >> bitsN) - ); - }); - }); - - t.end(); - }); - - test('BigInt::subtract', { skip: !hasBigInts }, function (t) { - forEach(v.nonBigInts, function (nonBigInt) { - t['throws']( - function () { ES.BigInt.subtract(nonBigInt, $BigInt(0)); }, - TypeError, - 'x: ' + debug(nonBigInt) + ' is not a BigInt' - ); - t['throws']( - function () { ES.BigInt.subtract($BigInt(0), nonBigInt); }, - TypeError, - 'y: ' + debug(nonBigInt) + ' is not a BigInt' - ); - }); - - t.equal(ES.BigInt.subtract($BigInt(0), $BigInt(0)), $BigInt(0), '0n - 0n is 0n'); - - forEach(v.bigints, function (bigint) { - t.equal(ES.BigInt.subtract(bigint, $BigInt(0)), bigint, debug(bigint) + ' - 0n produces ' + bigint); - t.equal(ES.BigInt.subtract(bigint, $BigInt(1)), bigint - $BigInt(1), debug(bigint) + ' - 1n produces ' + (bigint + $BigInt(1))); - t.equal(ES.BigInt.subtract(bigint, $BigInt(42)), bigint - $BigInt(42), debug(bigint) + ' - 42n produces ' + (bigint - $BigInt(42))); - }); - - t.end(); - }); - - test('BigInt::toString', function (t) { - forEach(v.nonBigInts, function (nonBigInt) { - t['throws']( - function () { ES.BigInt.toString(nonBigInt); }, - TypeError, - debug(nonBigInt) + ' is not a BigInt' - ); - }); - - forEach(v.bigints, function (bigint) { - t.equal(ES.BigInt.toString(bigint), String(bigint), debug(bigint) + ' stringifies to ' + bigint); - }); - - t.end(); - }); - - test('BigInt::unaryMinus', function (t) { - forEach(v.nonBigInts, function (nonBigInt) { - t['throws']( - function () { ES.BigInt.unaryMinus(nonBigInt); }, - TypeError, - debug(nonBigInt) + ' is not a BigInt' - ); - }); - - t.test('actual BigInts', { skip: !hasBigInts }, function (st) { - forEach(v.bigints, function (bigint) { - st.equal(ES.BigInt.unaryMinus(bigint), -bigint, debug(bigint) + ' produces -' + debug(bigint)); - }); - st.end(); - }); - - t.end(); - }); - - test('BigInt::unsignedRightShift', { skip: !hasBigInts }, function (t) { - forEach(v.nonBigInts, function (nonBigInt) { - t['throws']( - function () { ES.BigInt.unsignedRightShift(nonBigInt, $BigInt(0)); }, - TypeError, - 'x: ' + debug(nonBigInt) + ' is not a BigInt' - ); - t['throws']( - function () { ES.BigInt.unsignedRightShift($BigInt(0), nonBigInt); }, - TypeError, - 'y: ' + debug(nonBigInt) + ' is not a BigInt' - ); - }); - - forEach([0].concat(v.int32s), function (int32) { - var bigInt32 = $BigInt(int32); - forEach([1, 3, 5, 31, 32, 33], function (bits) { - var bitsN = $BigInt(bits); - t['throws']( - function () { ES.BigInt.unsignedRightShift(bigInt32, bitsN); }, - TypeError, - debug(bigInt32) + ' >>> ' + debug(bitsN) + ' throws' - ); - }); - }); - - t.end(); - }); - - test('BigIntBitwiseOp', { skip: !hasBigInts }, function (t) { - t['throws']( - function () { ES.BigIntBitwiseOp('invalid', BigInt(0), BigInt(0)); }, - TypeError, - 'throws with an invalid op' - ); - - t.equal(ES.BigIntBitwiseOp('&', BigInt(1), BigInt(2)), BigInt(1) & BigInt(2)); - t.equal(ES.BigIntBitwiseOp('|', BigInt(1), BigInt(2)), BigInt(1) | BigInt(2)); - t.equal(ES.BigIntBitwiseOp('^', BigInt(1), BigInt(2)), BigInt(1) ^ BigInt(2)); - - t.end(); - }); - - test('BinaryAnd', function (t) { - t.equal(ES.BinaryAnd(0, 0), 0); - t.equal(ES.BinaryAnd(0, 1), 0); - t.equal(ES.BinaryAnd(1, 0), 0); - t.equal(ES.BinaryAnd(1, 1), 1); - - forEach(v.nonIntegerNumbers.concat(v.nonNumberPrimitives, v.objects), function (nonBit) { - t['throws']( - function () { ES.BinaryAnd(0, nonBit); }, - TypeError - ); - t['throws']( - function () { ES.BinaryAnd(nonBit, 1); }, - TypeError - ); - }); - t.end(); - }); - - test('BinaryOr', function (t) { - t.equal(ES.BinaryOr(0, 0), 0); - t.equal(ES.BinaryOr(0, 1), 1); - t.equal(ES.BinaryOr(1, 0), 1); - t.equal(ES.BinaryOr(1, 1), 1); - - forEach(v.nonIntegerNumbers.concat(v.nonNumberPrimitives, v.objects), function (nonBit) { - t['throws']( - function () { ES.BinaryOr(0, nonBit); }, - TypeError - ); - t['throws']( - function () { ES.BinaryOr(nonBit, 1); }, - TypeError - ); - }); - t.end(); - }); - - test('BinaryXor', function (t) { - t.equal(ES.BinaryXor(0, 0), 0); - t.equal(ES.BinaryXor(0, 1), 1); - t.equal(ES.BinaryXor(1, 0), 1); - t.equal(ES.BinaryXor(1, 1), 0); - - forEach(v.nonIntegerNumbers.concat(v.nonNumberPrimitives, v.objects), function (nonBit) { - t['throws']( - function () { ES.BinaryXor(0, nonBit); }, - TypeError - ); - t['throws']( - function () { ES.BinaryXor(nonBit, 1); }, - TypeError - ); - }); - t.end(); - }); - - test('CodePointAt', function (t) { - t['throws']( - function () { ES.CodePointAt('abc', -1); }, - TypeError, - 'requires an index >= 0' - ); - t['throws']( - function () { ES.CodePointAt('abc', 3); }, - TypeError, - 'requires an index < string length' - ); - - t.deepEqual(ES.CodePointAt('abc', 0), { - '[[CodePoint]]': 'a', - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': false - }); - t.deepEqual(ES.CodePointAt('abc', 1), { - '[[CodePoint]]': 'b', - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': false - }); - t.deepEqual(ES.CodePointAt('abc', 2), { - '[[CodePoint]]': 'c', - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': false - }); - - var strWithHalfPoo = 'a' + leadingPoo + 'c'; - var strWithWholePoo = 'a' + wholePoo + 'd'; - - t.deepEqual(ES.CodePointAt(strWithHalfPoo, 0), { - '[[CodePoint]]': 'a', - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': false - }); - t.deepEqual(ES.CodePointAt(strWithHalfPoo, 1), { - '[[CodePoint]]': leadingPoo, - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': true - }); - t.deepEqual(ES.CodePointAt(strWithHalfPoo, 2), { - '[[CodePoint]]': 'c', - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': false - }); - - t.deepEqual(ES.CodePointAt(strWithWholePoo, 0), { - '[[CodePoint]]': 'a', - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': false - }); - t.deepEqual(ES.CodePointAt(strWithWholePoo, 1), { - '[[CodePoint]]': wholePoo, - '[[CodeUnitCount]]': 2, - '[[IsUnpairedSurrogate]]': false - }); - t.deepEqual(ES.CodePointAt(strWithWholePoo, 2), { - '[[CodePoint]]': trailingPoo, - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': true - }); - t.deepEqual(ES.CodePointAt(strWithWholePoo, 3), { - '[[CodePoint]]': 'd', - '[[CodeUnitCount]]': 1, - '[[IsUnpairedSurrogate]]': false - }); - - t.end(); - }); - - test('CopyDataProperties', function (t) { - t.test('first argument: target', function (st) { - forEach(v.primitives, function (primitive) { - st['throws']( - function () { ES.CopyDataProperties(primitive, {}, []); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - st.end(); - }); - - t.test('second argument: source', function (st) { - var frozenTarget = Object.freeze ? Object.freeze({}) : {}; - forEach(v.nullPrimitives, function (nullish) { - st.equal( - ES.CopyDataProperties(frozenTarget, nullish, []), - frozenTarget, - debug(nullish) + ' "source" yields identical, unmodified target' - ); - }); - - forEach(v.nonNullPrimitives, function (objectCoercible) { - var target = {}; - var result = ES.CopyDataProperties(target, objectCoercible, []); - st.equal(result, target, 'result === target'); - st.deepEqual(keys(result), keys(Object(objectCoercible)), 'target ends up with keys of ' + debug(objectCoercible)); - }); - - st.test('enumerable accessor property', { skip: !defineProperty.oDP }, function (s2t) { - var target = {}; - var source = {}; - defineProperty(source, 'a', { - enumerable: true, - get: function () { return 42; } - }); - var result = ES.CopyDataProperties(target, source, []); - s2t.equal(result, target, 'result === target'); - s2t.deepEqual(result, { a: 42 }, 'target ends up with enumerable accessor of source'); - s2t.end(); - }); - - st.end(); - }); - - t.test('third argument: excludedItems', function (st) { - forEach(v.objects.concat(v.primitives), function (nonArray) { - st['throws']( - function () { ES.CopyDataProperties({}, {}, nonArray); }, - TypeError, - debug(nonArray) + ' is not an Array' - ); - }); - - forEach(v.nonPropertyKeys, function (nonPropertyKey) { - st['throws']( - function () { ES.CopyDataProperties({}, {}, [nonPropertyKey]); }, - TypeError, - debug(nonPropertyKey) + ' is not a Property Key' - ); - }); - - var result = ES.CopyDataProperties({}, { a: 1, b: 2, c: 3 }, ['b']); - st.deepEqual(keys(result).sort(), ['a', 'c'].sort(), 'excluded string keys are excluded'); - - st.test('excluding symbols', { skip: !v.hasSymbols }, function (s2t) { - var source = {}; - forEach(v.symbols, function (symbol) { - source[symbol] = true; - }); - - var includedSymbols = v.symbols.slice(1); - var excludedSymbols = v.symbols.slice(0, 1); - var target = ES.CopyDataProperties({}, source, excludedSymbols); - - forEach(includedSymbols, function (symbol) { - s2t.equal(has(target, symbol), true, debug(symbol) + ' is included'); - }); - - forEach(excludedSymbols, function (symbol) { - s2t.equal(has(target, symbol), false, debug(symbol) + ' is excluded'); - }); - - s2t.end(); - }); - - st.end(); - }); - - // TODO: CopyDataProperties throws when copying fails - - t.end(); - }); - - test('GetIterator', function (t) { - try { - ES.GetIterator({}, null); - } catch (e) { - t.ok(e.message.indexOf('Assertion failed: `hint` must be one of \'sync\' or \'async\'' >= 0)); - } - - var arr = [1, 2]; - testIterator(t, ES.GetIterator(arr), arr); - - testIterator(t, ES.GetIterator('abc'), 'abc'.split('')); - - t.test('Symbol.iterator', { skip: !v.hasSymbols }, function (st) { - var m = new Map(); - m.set(1, 'a'); - m.set(2, 'b'); - - testIterator(st, ES.GetIterator(m), [[1, 'a'], [2, 'b']]); - - st.end(); - }); - - t.test('Symbol.asyncIterator', { skip: !v.hasSymbols || !Symbol.asyncIterator }, function (st) { - try { - ES.GetIterator(arr, 'async'); - } catch (e) { - st.ok(e.message.indexOf("async from sync iterators aren't currently supported") >= 0); - } - - var it = { - next: function () { - return Promise.resolve({ - done: true - }); - } - }; - var obj = {}; - obj[Symbol.asyncIterator] = function () { - return it; - }; - - st.equal(ES.GetIterator(obj, 'async'), it); - - st.end(); - }); - - t.end(); - }); - - var unclampedUnsignedIntegerTypes = [ - 'Int8', - 'Int16', - 'Int32' - ]; - var clampedTypes = [ - 'Uint8C' - ]; - var unclampedSignedIntegerTypes = [ - 'Uint8', - 'Uint16', - 'Uint32' - ]; - var unclampedIntegerTypes = unclampedUnsignedIntegerTypes.concat(unclampedSignedIntegerTypes); - var floatTypes = [ - 'Float32', - 'Float64' - ]; - var integerTypes = unclampedIntegerTypes.concat(clampedTypes, floatTypes); - var bigIntTypes = [ - 'BigInt64', - 'BigUint64' - ]; - var numberTypes = floatTypes.concat(integerTypes); - var nonIntegerTypes = floatTypes.concat(bigIntTypes); - var unsignedElementTypes = unclampedSignedIntegerTypes.concat([ - 'BigUint64' - ]); - var signedElementTypes = unclampedUnsignedIntegerTypes; - - test('IsBigIntElementType', function (t) { - forEach(bigIntTypes, function (type) { - t.equal( - ES.IsBigIntElementType(type), - true, - debug(type) + ' is a BigInt element type' - ); - }); - - forEach(numberTypes, function (type) { - t.equal( - ES.IsBigIntElementType(type), - false, - debug(type) + ' is not a BigInt element type' - ); - }); - - t.end(); - }); - - test('IsUnsignedElementType', function (t) { - forEach(unsignedElementTypes, function (type) { - t.equal( - ES.IsUnsignedElementType(type), - true, - debug(type) + ' is an unsigned element type' - ); - }); - - forEach(signedElementTypes, function (type) { - t.equal( - ES.IsUnsignedElementType(type), - false, - debug(type) + ' is not an unsigned element type' - ); - }); - - t.end(); - }); - - test('IsUnclampedIntegerElementType', function (t) { - forEach(unclampedIntegerTypes, function (type) { - t.equal( - ES.IsUnclampedIntegerElementType(type), - true, - debug(type) + ' is an unclamped integer element type' - ); - }); - - forEach(clampedTypes.concat(nonIntegerTypes), function (type) { - t.equal( - ES.IsUnclampedIntegerElementType(type), - false, - debug(type) + ' is not an unclamped integer element type' - ); - }); - - t.end(); - }); - - test('IsNonNegativeInteger', function (t) { - forEach(v.notNonNegativeIntegers, function (nonIntegerNumber) { - t.equal( - ES.IsNonNegativeInteger(nonIntegerNumber), - false, - debug(nonIntegerNumber) + ' is not a non-negative integer' - ); - }); - - forEach(v.zeroes.concat(v.integerNumbers), function (nonNegativeInteger) { - t.equal( - ES.IsNonNegativeInteger(nonNegativeInteger), - true, - debug(nonNegativeInteger) + ' is a non-negative integer' - ); - }); - - t.end(); - }); - - test('IsNoTearConfiguration', function (t) { - forEach(unclampedIntegerTypes, function (type) { - t.equal( - ES.IsNoTearConfiguration(type), - true, - debug(type) + ' with any order is a no-tear configuration' - ); - }); - - forEach(bigIntTypes, function (type) { - t.equal( - ES.IsNoTearConfiguration(type, 'Init'), - false, - debug(type) + ' with ' + debug('Init') + ' is not a no-tear configuration' - ); - - t.equal( - ES.IsNoTearConfiguration(type, 'Unordered'), - false, - debug(type) + ' with ' + debug('Unordered') + ' is not a no-tear configuration' - ); - - t.equal( - ES.IsNoTearConfiguration(type), - true, - debug(type) + ' with any other order is a no-tear configuration' - ); - }); - - forEach(clampedTypes, function (type) { - t.equal( - ES.IsNoTearConfiguration(type), - false, - debug(type) + ' with any order is not a no-tear configuration' - ); - }); - - t.end(); - }); - - test('LengthOfArrayLike', function (t) { - forEach(v.primitives, function (primitive) { - t['throws']( - function () { ES.LengthOfArrayLike(primitive); }, - TypeError, - debug(primitive) + ' is not an Object' - ); - }); - - t.equal(ES.LengthOfArrayLike([]), 0); - t.equal(ES.LengthOfArrayLike([1]), 1); - t.equal(ES.LengthOfArrayLike({ length: 42 }), 42); - - t.end(); - }); - - test('Number::add', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.add(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.add(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.add(+Infinity, +Infinity), +Infinity, '+∞ + +∞ is +∞'); - t.equal(ES.Number.add(-Infinity, -Infinity), -Infinity, '-∞ + -∞ is -∞'); - t.equal(ES.Number.add(+Infinity, -Infinity), NaN, '+∞ + -∞ is NaN'); - t.equal(ES.Number.add(-Infinity, +Infinity), NaN, '-∞ + +∞ is NaN'); - - t.equal(ES.Number.add(+0, +0), +0, '0 + 0 is +0'); - t.equal(ES.Number.add(+0, -0), +0, '0 + -0 is +0'); - t.equal(ES.Number.add(-0, +0), +0, '-0 + 0 is +0'); - t.equal(ES.Number.add(-0, -0), -0, '-0 + -0 is -0'); - - forEach(v.numbers, function (number) { - if (number !== 0) { - t.equal(ES.Number.add(number, 0), number, debug(number) + ' + 0 adds to ' + number); - } - t.equal(ES.Number.add(number, 1), number + 1, debug(number) + ' + 1 adds to ' + (number + 1)); - t.equal(ES.Number.add(1, number), number + 1, '1 + ' + debug(number) + ' adds to ' + (number + 1)); - t.equal(ES.Number.add(number, -42), number - 42, debug(number) + ' + -42 adds to ' + (number - 42)); - t.equal(ES.Number.add(-42, number), number - 42, '-42 + ' + debug(number) + ' adds to ' + (number - 42)); - }); - - t.end(); - }); - - test('Number::bitwiseAND', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.bitwiseAND(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.bitwiseAND(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.bitwiseAND(1, 2), 1 & 2); - - t.end(); - }); - - test('Number::bitwiseNOT', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.bitwiseNOT(nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a Number' - ); - }); - - forEach(v.int32s, function (int32) { - t.equal(ES.Number.bitwiseNOT(int32), ~int32, debug(int32) + ' becomes ~' + debug(int32)); - }); - - t.end(); - }); - - test('Number::bitwiseOR', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.bitwiseOR(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.bitwiseOR(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.bitwiseOR(1, 2), 1 | 2); - - t.end(); - }); - - test('Number::bitwiseXOR', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.bitwiseXOR(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.bitwiseXOR(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.bitwiseXOR(1, 2), 1 ^ 2); - - t.end(); - }); - - test('Number::divide', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.divide(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.divide(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.divide(Infinity, Infinity), NaN, '∞ / ∞ is NaN'); - t.equal(ES.Number.divide(-Infinity, Infinity), NaN, '-∞ / ∞ is NaN'); - t.equal(ES.Number.divide(Infinity, -Infinity), NaN, '∞ / -∞ is NaN'); - t.equal(ES.Number.divide(-Infinity, -Infinity), NaN, '-∞ / -∞ is NaN'); - - t.equal(ES.Number.divide(NaN, NaN), NaN, 'NaN / NaN is NaN'); - - t.equal(ES.Number.divide(+Infinity, +0), +Infinity, '+∞ / +0 is +∞'); - t.equal(ES.Number.divide(-Infinity, -0), +Infinity, '-∞ / -0 is +∞'); - t.equal(ES.Number.divide(+Infinity, -0), -Infinity, '+∞ / -0 is -∞'); - t.equal(ES.Number.divide(-Infinity, +0), -Infinity, '-∞ / +0 is -∞'); - - t.equal(ES.Number.divide(+0, +Infinity), +0, '+0 / +∞ is +0'); - t.equal(ES.Number.divide(-0, -Infinity), +0, '-0 / -∞ is +0'); - t.equal(ES.Number.divide(-0, +Infinity), -0, '-0 / +∞ is -0'); - t.equal(ES.Number.divide(+0, -Infinity), -0, '+0 / -∞ is -0'); - - forEach(v.numbers, function (number) { - if (number !== 0 && isFinite(number)) { - t.equal(ES.Number.divide(number, number), 1, debug(number) + ' divided by itself is 1'); - t.equal(ES.Number.divide(number, 2), number / 2, debug(number) + ' divided by 2 is half itself'); - } - }); - - t.end(); - }); - - test('Number::equal', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.equal(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.equal(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.equal(Infinity, Infinity), true, '∞ === ∞'); - t.equal(ES.Number.equal(-Infinity, Infinity), false, '-∞ !== ∞'); - t.equal(ES.Number.equal(Infinity, -Infinity), false, '∞ !== -∞'); - t.equal(ES.Number.equal(-Infinity, -Infinity), true, '-∞ === -∞'); - - t.equal(ES.Number.equal(NaN, NaN), false, 'NaN !== NaN'); - - t.equal(ES.Number.equal(Infinity, 0), false, '∞ !== 0'); - t.equal(ES.Number.equal(-Infinity, -0), false, '-∞ !== -0'); - t.equal(ES.Number.equal(Infinity, -0), false, '∞ !== -0'); - t.equal(ES.Number.equal(-Infinity, 0), false, '-∞ !== 0'); - - t.equal(ES.Number.equal(+0, +0), true, '+0 === +0'); - t.equal(ES.Number.equal(+0, -0), true, '+0 === -0'); - t.equal(ES.Number.equal(-0, +0), true, '-0 === +0'); - t.equal(ES.Number.equal(-0, -0), true, '-0 === -0'); - - forEach(v.numbers, function (number) { - if (isFinite(number)) { - t.equal(ES.Number.equal(number, number), true, debug(number) + ' is equal to itself'); - t.equal(ES.Number.equal(number, number + 1), false, debug(number) + ' is not equal to itself plus 1'); - } - }); - - t.end(); - }); - - test('Number::exponentiate', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.exponentiate(nonNumber, 0); }, - TypeError, - 'base: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.exponentiate(0, nonNumber); }, - TypeError, - 'exponent: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.exponentiate(0, 42), 0, '+0 ** 42 is +0'); - t.equal(ES.Number.exponentiate(0, -42), Infinity, '+0 ** 42 is +∞'); - t.equal(ES.Number.exponentiate(-0, 42), 0, '-0 ** 42 is +0'); - t.equal(ES.Number.exponentiate(-0, 41), -0, '-0 ** 41 is -0'); - t.equal(ES.Number.exponentiate(-0, -42), Infinity, '-0 ** 42 is +∞'); - t.equal(ES.Number.exponentiate(-0, -41), -Infinity, '-0 ** 41 is -∞'); - - t.equal(ES.Number.exponentiate(Infinity, 0), 1, '+∞ ** 0 is 1'); - t.equal(ES.Number.exponentiate(Infinity, -0), 1, '+∞ ** -0 is 1'); - t.equal(ES.Number.exponentiate(-Infinity, 0), 1, '-∞ ** 0 is 1'); - t.equal(ES.Number.exponentiate(-Infinity, -0), 1, '-∞ ** -0 is 1'); - - t.equal(ES.Number.exponentiate(Infinity, 1), Infinity, '+∞ ** 1 is +∞'); - t.equal(ES.Number.exponentiate(Infinity, 2), Infinity, '+∞ ** 2 is +∞'); - t.equal(ES.Number.exponentiate(Infinity, -1), +0, '+∞ ** -1 is +0'); - t.equal(ES.Number.exponentiate(Infinity, -2), +0, '+∞ ** -2 is +0'); - - t.equal(ES.Number.exponentiate(-Infinity, 1), -Infinity, '-∞ ** 1 is -∞'); - t.equal(ES.Number.exponentiate(-Infinity, 2), Infinity, '-∞ ** 2 is +∞'); - t.equal(ES.Number.exponentiate(-Infinity, -1), -0, '-∞ ** --1 is -0'); - t.equal(ES.Number.exponentiate(-Infinity, -2), +0, '-∞ ** --2 is +0'); - - t.equal(ES.Number.exponentiate(1.1, Infinity), Infinity, '1.1 ** +∞ is +∞'); - t.equal(ES.Number.exponentiate(1.1, -Infinity), 0, '1.1 ** -∞ is +0'); - t.equal(ES.Number.exponentiate(-1.1, Infinity), Infinity, '-1.1 ** +∞ is +∞'); - t.equal(ES.Number.exponentiate(-1.1, -Infinity), 0, '-1.1 ** -∞ is +0'); - - t.equal(ES.Number.exponentiate(1, Infinity), NaN, '1 ** +∞ is NaN'); - t.equal(ES.Number.exponentiate(1, -Infinity), NaN, '1 ** -∞ is NaN'); - t.equal(ES.Number.exponentiate(-1, Infinity), NaN, '-1 ** +∞ is NaN'); - t.equal(ES.Number.exponentiate(-1, -Infinity), NaN, '-1 ** -∞ is NaN'); - - t.equal(ES.Number.exponentiate(0.9, Infinity), 0, '0.9 ** +∞ is +0'); - t.equal(ES.Number.exponentiate(0.9, -Infinity), Infinity, '0.9 ** -∞ is ∞'); - t.equal(ES.Number.exponentiate(-0.9, Infinity), 0, '-0.9 ** +∞ is +0'); - t.equal(ES.Number.exponentiate(-0.9, -Infinity), Infinity, '-0.9 ** -∞ is +∞'); - - forEach(v.numbers.concat(NaN), function (number) { - t.equal(ES.Number.exponentiate(number, NaN), NaN, debug(number) + ' ** NaN is NaN'); - - if (number !== 0) { - t.equal(ES.Number.exponentiate(number, 0), 1, debug(number) + ' ** +0 is 1'); - t.equal(ES.Number.exponentiate(number, -0), 1, debug(number) + ' ** -0 is 1'); - t.equal(ES.Number.exponentiate(NaN, number), NaN, 'NaN ** ' + debug(number) + ' is NaN'); - } - - if (number !== 0 && isFinite(number)) { - t.equal(ES.Number.equal(number, number), true, debug(number) + ' is equal to itself'); - t.equal(ES.Number.equal(number, number + 1), false, debug(number) + ' is not equal to itself plus 1'); - } - }); - - t.end(); - }); - - test('Number::leftShift', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.leftShift(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.leftShift(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - forEach([0].concat(v.int32s), function (int32) { - forEach([1, 3, 5, 31, 32, 33], function (bits) { - t.equal(ES.Number.leftShift(int32, bits), int32 << bits, debug(int32) + ' << ' + bits + ' is ' + debug(int32 << bits)); - }); - }); - - t.end(); - }); - - test('Number::lessThan', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.lessThan(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.lessThan(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.lessThan(+0, -0), false, '+0 < -0 is false'); - t.equal(ES.Number.lessThan(+0, +0), false, '+0 < +0 is false'); - t.equal(ES.Number.lessThan(-0, +0), false, '-0 < +0 is false'); - t.equal(ES.Number.lessThan(-0, -0), false, '-0 < -0 is false'); - - t.equal(ES.Number.lessThan(NaN, NaN), undefined, 'NaN < NaN is undefined'); - - t.equal(ES.Number.lessThan(+Infinity, +Infinity), false, '+∞ < +∞ is false'); - t.equal(ES.Number.lessThan(+Infinity, -Infinity), false, '+∞ < -∞ is false'); - t.equal(ES.Number.lessThan(-Infinity, +Infinity), true, '-∞ < +∞ is true'); - t.equal(ES.Number.lessThan(-Infinity, -Infinity), false, '-∞ < -∞ is false'); - - forEach(v.numbers.concat(v.infinities), function (number) { - t.equal(ES.Number.lessThan(NaN, number), undefined, 'NaN < ' + debug(number) + ' is undefined'); - t.equal(ES.Number.lessThan(number, NaN), undefined, debug(number) + ' < NaN is undefined'); - - t.equal(ES.Number.lessThan(number, number), false, debug(number) + ' is not less than itself'); - - if (isFinite(number)) { - t.equal(ES.Number.lessThan(number, number + 1), true, debug(number) + ' < ' + debug(number + 1) + ' is true'); - t.equal(ES.Number.lessThan(number + 1, number), false, debug(number + 1) + ' < ' + debug(number) + ' is false'); - - t.equal(ES.Number.lessThan(Infinity, number), false, '+∞ < ' + debug(number) + ' is false'); - t.equal(ES.Number.lessThan(number, Infinity), true, debug(number) + ' < +∞ is true'); - t.equal(ES.Number.lessThan(-Infinity, number), true, '-∞ < ' + debug(number) + ' is true'); - t.equal(ES.Number.lessThan(number, -Infinity), false, debug(number) + ' < -∞ is false'); - } - }); - - t.end(); - }); - - test('Number::multiply', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.multiply(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.multiply(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - forEach([+0, -0, 1, -1], function (x) { - var expected = x === 0 ? NaN : Infinity; - t.equal(ES.Number.multiply(Infinity, x), expected, '+∞ * ' + debug(x) + ' is ' + debug(expected)); - t.equal(ES.Number.multiply(x, Infinity), expected, debug(x) + ' * +∞ is ' + debug(expected)); - t.equal(ES.Number.multiply(-Infinity, x), -expected, '-∞ * ' + debug(x) + ' is ' + debug(expected)); - t.equal(ES.Number.multiply(x, -Infinity), -expected, debug(x) + ' * -∞ is ' + debug(expected)); - }); - - t.equal(ES.Number.multiply(Infinity, Infinity), Infinity, '+∞ * +∞ is +∞'); - t.equal(ES.Number.multiply(Infinity, -Infinity), -Infinity, '+∞ * -∞ is -∞'); - t.equal(ES.Number.multiply(-Infinity, Infinity), -Infinity, '-∞ * +∞ is -∞'); - t.equal(ES.Number.multiply(-Infinity, -Infinity), Infinity, '-∞ * -∞ is +∞'); - - t.equal(ES.Number.multiply(+0, +0), +0, '0 * 0 is +0'); - t.equal(ES.Number.multiply(+0, -0), -0, '0 * -0 is -0'); - t.equal(ES.Number.multiply(-0, +0), -0, '-0 * 0 is -0'); - t.equal(ES.Number.multiply(-0, -0), +0, '-0 * -0 is +0'); - - forEach(v.numbers.concat(NaN), function (number) { - t.equal(ES.Number.multiply(NaN, number), NaN, 'NaN * ' + debug(number) + ' is NaN'); - t.equal(ES.Number.multiply(number, NaN), NaN, debug(number) + ' * NaN is NaN'); - - if (number !== 0 && isFinite(number)) { - t.equal(ES.Number.multiply(number, 0), number > 0 ? 0 : -0, debug(number) + ' * +0 produces ' + (number > 0 ? '+0' : '-0')); - t.equal(ES.Number.multiply(0, number), number > 0 ? 0 : -0, '+0 * ' + debug(number) + ' produces ' + (number > 0 ? '+0' : '-0')); - t.equal(ES.Number.multiply(number, -0), number > 0 ? -0 : 0, debug(number) + ' * -0 produces ' + (number > 0 ? '-0' : '+0')); - t.equal(ES.Number.multiply(-0, number), number > 0 ? -0 : 0, '-0 * ' + debug(number) + ' produces ' + (number > 0 ? '-0' : '+0')); - t.equal(ES.Number.multiply(number, 1), number, debug(number) + ' * 1 produces itself'); - t.equal(ES.Number.multiply(number, -42), number * -42, debug(number) + ' * -42 produces ' + (number - 42)); - } - }); - - t.end(); - }); - - test('Number::remainder', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.remainder(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.remainder(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.remainder(NaN, NaN), NaN, 'NaN % NaN is NaN'); - - t.equal(ES.Number.remainder(+0, +0), NaN, '+0 % +0 is NaN'); - t.equal(ES.Number.remainder(+0, -0), NaN, '+0 % -0 is NaN'); - t.equal(ES.Number.remainder(-0, +0), NaN, '-0 % +0 is NaN'); - t.equal(ES.Number.remainder(-0, -0), NaN, '-0 % -0 is NaN'); - - forEach(v.numbers, function (number) { - t.equal(ES.Number.remainder(number, NaN), NaN, debug(number) + ' % NaN is NaN'); - t.equal(ES.Number.remainder(NaN, number), NaN, 'NaN % ' + debug(number) + ' is NaN'); - - t.equal(ES.Number.remainder(Infinity, number), NaN, '+∞ % ' + debug(number) + ' is NaN'); - t.equal(ES.Number.remainder(-Infinity, number), NaN, '-∞ % ' + debug(number) + ' is NaN'); - t.equal(ES.Number.remainder(number, 0), NaN, debug(number) + ' % +0 is NaN'); - t.equal(ES.Number.remainder(number, -0), NaN, debug(number) + ' % -0 is NaN'); - - if (isFinite(number)) { - t.equal(ES.Number.remainder(number, Infinity), number, debug(number) + ' % +∞ is ' + debug(number)); - t.equal(ES.Number.remainder(number, -Infinity), number, debug(number) + ' % -∞ is ' + debug(number)); - if (number !== 0) { - t.equal(ES.Number.remainder(0, number), 0, '+0 % ' + debug(number) + ' is ' + debug(number)); - t.equal(ES.Number.remainder(-0, number), -0, '-0 % ' + debug(number) + ' is ' + debug(number)); - t.looseEqual(ES.Number.remainder(number * 2, number), 0, debug(number) + ' % ' + debug(number * 2) + ' is 0'); - } - } - }); - - t.end(); - }); - - test('Number::sameValue', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.sameValue(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.sameValue(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.ok(ES.Number.sameValue(NaN, NaN), true, 'NaN is the sameValue as NaN'); - - t.equal(ES.Number.sameValue(+0, +0), true, '+0 is sameValue as +0'); - t.equal(ES.Number.sameValue(+0, -0), false, '+0 is not sameValue as -0'); - t.equal(ES.Number.sameValue(-0, +0), false, '-0 is not sameValue as +0'); - t.equal(ES.Number.sameValue(-0, -0), true, '-0 is sameValue as -0'); - - forEach(v.numbers, function (number) { - t.ok(ES.Number.sameValue(number, number), debug(number) + ' is the sameValue as itself'); - }); - - t.end(); - }); - - test('Number::sameValueZero', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.sameValueZero(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.sameValueZero(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.ok(ES.Number.sameValueZero(NaN, NaN), true, 'NaN is the sameValueZero as NaN'); - - t.equal(ES.Number.sameValueZero(+0, +0), true, '+0 is sameValueZero as +0'); - t.equal(ES.Number.sameValueZero(+0, -0), true, '+0 is sameValueZero as -0'); - t.equal(ES.Number.sameValueZero(-0, +0), true, '-0 is sameValueZero as +0'); - t.equal(ES.Number.sameValueZero(-0, -0), true, '-0 is sameValueZero as -0'); - - forEach(v.numbers, function (number) { - t.ok(ES.Number.sameValueZero(number, number), debug(number) + ' is the sameValueZero as itself'); - }); - - t.end(); - }); - - test('Number::signedRightShift', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.signedRightShift(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.signedRightShift(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - forEach([0].concat(v.int32s), function (int32) { - forEach([1, 3, 5, 31, 32, 33], function (bits) { - t.equal(ES.Number.signedRightShift(int32, bits), int32 >> bits, debug(int32) + ' >> ' + bits + ' is ' + debug(int32 >> bits)); - }); - }); - - t.end(); - }); - - test('Number::subtract', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.subtract(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.subtract(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.subtract(+0, +0), +0, '0 - 0 is +0'); - t.equal(ES.Number.subtract(+0, -0), +0, '0 - -0 is +0'); - t.equal(ES.Number.subtract(-0, +0), -0, '-0 - 0 is -0'); - t.equal(ES.Number.subtract(-0, -0), +0, '-0 - -0 is +0'); - - forEach(v.numbers, function (number) { - if (number !== 0) { - t.equal(ES.Number.subtract(number, 0), number, debug(number) + ' - 0 produces ' + number); - } - t.equal(ES.Number.subtract(number, 1), number - 1, debug(number) + ' - 1 produces ' + (number + 1)); - t.equal(ES.Number.subtract(number, 42), number - 42, debug(number) + ' - 42 produces ' + (number - 42)); - }); - - t.end(); - }); - - test('Number::toString', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.toString(nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a Number' - ); - }); - - forEach(v.numbers, function (number) { - t.equal(ES.Number.toString(number), String(number), debug(number) + ' stringifies to ' + number); - }); - - t.end(); - }); - - test('Number::unaryMinus', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.unaryMinus(nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.Number.unaryMinus(NaN), NaN, 'NaN produces NaN'); - - forEach(v.numbers, function (number) { - t.equal(ES.Number.unaryMinus(number), -number, debug(number) + ' produces -' + debug(number)); - }); - - t.end(); - }); - - test('Number::unsignedRightShift', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.Number.unsignedRightShift(nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.Number.unsignedRightShift(0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - forEach([0].concat(v.int32s), function (int32) { - forEach([1, 3, 5, 31, 32, 33], function (bits) { - t.equal(ES.Number.unsignedRightShift(int32, bits), int32 >>> bits, debug(int32) + ' >>> ' + bits + ' is ' + debug(int32 >>> bits)); - }); - }); - - t.end(); - }); - - test('NumberToBigInt', function (t) { - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.NumberToBigInt(nonNumber); }, - TypeError, - debug(nonNumber) + ' is not a Number' - ); - }); - - forEach(v.nonIntegerNumbers, function (nonIntegerNumber) { - t['throws']( - function () { ES.NumberToBigInt(nonIntegerNumber); }, - RangeError, - debug(nonIntegerNumber) + ' is not an integer' - ); - }); - - t.test('actual BigInts', { skip: !hasBigInts }, function (st) { - forEach(v.integerNumbers, function (int) { - if (int >= 1e17) { - // BigInt(1e17) throws on node v10.4 - v10.8 - try { - st.equal(ES.NumberToBigInt(int), $BigInt(int), debug(int) + ' becomes ' + debug($BigInt(int))); - } catch (e) { - st['throws']( - function () { $BigInt(int); }, - RangeError, - debug(int) + ' is too large on this engine to convert into a BigInt' - ); - } - } else { - st.equal(ES.NumberToBigInt(int), $BigInt(int), debug(int) + ' becomes ' + debug($BigInt(int))); - } - }); - st.end(); - }); - - t.end(); - }); - - test('OrdinaryObjectCreate', function (t) { - forEach(v.nonNullPrimitives, function (value) { - t['throws']( - function () { ES.OrdinaryObjectCreate(value); }, - TypeError, - debug(value) + ' is not null, or an object' - ); - }); - - t.test('proto arg', function (st) { - var Parent = function Parent() {}; - Parent.prototype.foo = {}; - var child = ES.OrdinaryObjectCreate(Parent.prototype); - st.equal(child instanceof Parent, true, 'child is instanceof Parent'); - st.equal(child.foo, Parent.prototype.foo, 'child inherits properties from Parent.prototype'); - - st.end(); - }); - - t.test('internal slots arg', function (st) { - st.doesNotThrow(function () { ES.OrdinaryObjectCreate({}, []); }, 'an empty slot list is valid'); - - st['throws']( - function () { ES.OrdinaryObjectCreate({}, ['a']); }, - SyntaxError, - 'internal slots are not supported' - ); - - st.end(); - }); - - t.test('null proto', { skip: !$setProto }, function (st) { - st.equal('toString' in {}, true, 'normal objects have toString'); - st.equal('toString' in ES.OrdinaryObjectCreate(null), false, 'makes a null object'); - - st.end(); - }); - - t.test('null proto when no native Object.create', { skip: $setProto }, function (st) { - st['throws']( - function () { ES.OrdinaryObjectCreate(null); }, - SyntaxError, - 'without a native Object.create, can not create null objects' - ); - - st.end(); - }); - - t.end(); - }); - - test('SameValueNonNumeric', function (t) { - var willThrow = [ - [3, 4], - [NaN, 4], - [4, ''], - ['abc', true], - [{}, false] - ]; - forEach(willThrow, function (nums) { - t['throws'](function () { return ES.SameValueNonNumeric.apply(ES, nums); }, TypeError, 'value must be same type and non-number'); - }); - - forEach(v.objects.concat(v.nonNumberPrimitives), function (val) { - t.equal(val === val, ES.SameValueNonNumeric(val, val), debug(val) + ' is SameValueNonNumeric to itself'); - }); - - t.end(); - }); - - test('StringPad', function (t) { - t.equal(ES.StringPad('a', 3, undefined, 'start'), ' a'); - t.equal(ES.StringPad('a', 3, undefined, 'end'), 'a '); - t.equal(ES.StringPad('a', 3, '0', 'start'), '00a'); - t.equal(ES.StringPad('a', 3, '0', 'end'), 'a00'); - t.equal(ES.StringPad('a', 3, '012', 'start'), '01a'); - t.equal(ES.StringPad('a', 3, '012', 'end'), 'a01'); - t.equal(ES.StringPad('a', 7, '012', 'start'), '012012a'); - t.equal(ES.StringPad('a', 7, '012', 'end'), 'a012012'); - - t.end(); - }); - - test('thisBigIntValue', { skip: !hasBigInts }, function (t) { - t.equal(ES.thisBigIntValue(BigInt(42)), BigInt(42)); - t.equal(ES.thisBigIntValue(Object(BigInt(42))), BigInt(42)); - - forEach(v.nonBigInts, function (nonBigInt) { - t['throws']( - function () { ES.thisBigIntValue(nonBigInt); }, - TypeError, - debug(nonBigInt) + ' is not a BigInt' - ); - }); - - t.end(); - }); - - test('ToInteger', function (t) { - forEach([0, -0, NaN], function (num) { - t.equal(0, ES.ToInteger(num), debug(num) + ' returns +0'); - }); - forEach([Infinity, 42], function (num) { - t.equal(num, ES.ToInteger(num), debug(num) + ' returns itself'); - t.equal(-num, ES.ToInteger(-num), '-' + debug(num) + ' returns itself'); - }); - t.equal(3, ES.ToInteger(Math.PI), 'pi returns 3'); - t['throws'](function () { return ES.ToInteger(v.uncoercibleObject); }, TypeError, 'uncoercibleObject throws'); - t.end(); - }); - - test('ToNumber', function (t) { - testToNumber(t, ES, ES.ToNumber); - - forEach(v.bigints, function (bigInt) { - t['throws']( - function () { ES.ToNumber(bigInt); }, - TypeError, - 'ToNumber of ' + debug(bigInt) + ' throws' - ); - - var boxed = Object(bigInt); - t['throws']( - function () { ES.ToNumber(boxed); }, - TypeError, - 'ToNumber of ' + debug(boxed) + ' throws' - ); - }); - - t.end(); - }); - - test('UTF16DecodeSurrogatePair', function (t) { - t['throws']( - function () { ES.UTF16DecodeSurrogatePair('a'.charCodeAt(0), trailingPoo.charCodeAt(0)); }, - TypeError, - '"a" is not a leading surrogate' - ); - t['throws']( - function () { ES.UTF16DecodeSurrogatePair(leadingPoo.charCodeAt(0), 'b'.charCodeAt(0)); }, - TypeError, - '"b" is not a trailing surrogate' - ); - - t.equal(ES.UTF16DecodeSurrogatePair(leadingPoo.charCodeAt(0), trailingPoo.charCodeAt(0)), wholePoo); - - t.end(); - }); - - test('NumberBitwiseOp', function (t) { - t['throws']( - function () { ES.NumberBitwiseOp('invalid', 0, 0); }, - TypeError, - 'throws with an invalid op' - ); - - forEach(v.nonNumbers, function (nonNumber) { - t['throws']( - function () { ES.NumberBitwiseOp('&', nonNumber, 0); }, - TypeError, - 'x: ' + debug(nonNumber) + ' is not a Number' - ); - t['throws']( - function () { ES.NumberBitwiseOp('&', 0, nonNumber); }, - TypeError, - 'y: ' + debug(nonNumber) + ' is not a Number' - ); - }); - - t.equal(ES.NumberBitwiseOp('&', 1, 2), 1 & 2); - t.equal(ES.NumberBitwiseOp('|', 1, 2), 1 | 2); - t.equal(ES.NumberBitwiseOp('^', 1, 2), 1 ^ 2); - - t.end(); - }); - - test('ToNumeric', function (t) { - testToNumber(t, ES, ES.ToNumeric); - - t.test('BigInts', { skip: !hasBigInts }, function (st) { - st.equal(ES.ToNumeric(BigInt(42)), BigInt(42), debug(BigInt(42)) + ' is ' + debug(BigInt(42))); - st.equal(ES.ToNumeric(Object(BigInt(42))), BigInt(42), debug(Object(BigInt(42))) + ' is ' + debug(BigInt(42))); - - var valueOf = { valueOf: function () { return BigInt(7); } }; - st.equal(ES.ToNumeric(valueOf), valueOf.valueOf(), debug(valueOf) + ' is ' + debug(valueOf.valueOf())); - - var toPrimitive = {}; - var value = BigInt(-2); - toPrimitive[Symbol.toPrimitive] = function () { return value; }; - st.equal(ES.ToNumeric(toPrimitive), value, debug(toPrimitive) + ' is ' + debug(value)); - - st.end(); - }); - - t.end(); - }); - - test('UTF16DecodeString', function (t) { - forEach(v.nonStrings, function (nonString) { - t['throws']( - function () { ES.UTF16DecodeString(nonString); }, - TypeError, - debug(nonString) + ' is not a String' - ); - }); - - t.deepEqual(ES.UTF16DecodeString('abc'), ['a', 'b', 'c'], 'code units get split'); - t.deepEqual(ES.UTF16DecodeString('a' + wholePoo + 'c'), ['a', wholePoo, 'c'], 'code points get split too'); - - t.end(); - }); -}; - -module.exports = { - es5: es5, - es2015: es2015, - es2016: es2016, - es2017: es2017, - es2018: es2018, - es2019: es2019, - es2020: es2020 -}; diff --git a/docs/snippets/node_modules/es-to-primitive/package.json b/docs/snippets/node_modules/es-to-primitive/package.json index f077a1ff..bc097350 100644 --- a/docs/snippets/node_modules/es-to-primitive/package.json +++ b/docs/snippets/node_modules/es-to-primitive/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "_shasum": "e55cd4c9cdc188bcefb03b366c736323fc5c898a", "_spec": "es-to-primitive@^1.2.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/es-abstract", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" diff --git a/docs/snippets/node_modules/es6-object-assign/package.json b/docs/snippets/node_modules/es6-object-assign/package.json index b4fec288..af9cdd46 100644 --- a/docs/snippets/node_modules/es6-object-assign/package.json +++ b/docs/snippets/node_modules/es6-object-assign/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", "_shasum": "c2c3582656247c39ea107cb1e6652b6f9f24523c", "_spec": "es6-object-assign@^1.1.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/assert", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/assert", "author": { "name": "Rubén Norte", "email": "rubennorte@gmail.com" diff --git a/docs/snippets/node_modules/escape-html/package.json b/docs/snippets/node_modules/escape-html/package.json index 48b3457a..fcf05051 100644 --- a/docs/snippets/node_modules/escape-html/package.json +++ b/docs/snippets/node_modules/escape-html/package.json @@ -24,7 +24,7 @@ "_resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "_shasum": "0258eae4d3d0c0974de1c169188ef0051d1d1988", "_spec": "escape-html@~1.0.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "bugs": { "url": "https://github.com/component/escape-html/issues" }, diff --git a/docs/snippets/node_modules/etag/package.json b/docs/snippets/node_modules/etag/package.json index 5cf15c8d..7832abea 100644 --- a/docs/snippets/node_modules/etag/package.json +++ b/docs/snippets/node_modules/etag/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "_shasum": "41ae2eeb65efa62268aebfea83ac7d79299b0887", "_spec": "etag@~1.8.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "bugs": { "url": "https://github.com/jshttp/etag/issues" }, diff --git a/docs/snippets/node_modules/express/package.json b/docs/snippets/node_modules/express/package.json index cdba74cc..ae3918c1 100644 --- a/docs/snippets/node_modules/express/package.json +++ b/docs/snippets/node_modules/express/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", "_shasum": "4491fc38605cf51f8629d39c2b5d026f98a4c134", "_spec": "express@^4.17.1", - "_where": "/home/gares/MATHCOMP/mcb/coq", + "_where": "/storage/current_data/mathcomp-book/1/coq", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" diff --git a/docs/snippets/node_modules/eyes/package.json b/docs/snippets/node_modules/eyes/package.json index da5df631..a1ce5374 100644 --- a/docs/snippets/node_modules/eyes/package.json +++ b/docs/snippets/node_modules/eyes/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", "_shasum": "62cf120234c683785d902348a800ef3e0cc20bc0", "_spec": "eyes@0.1.x", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/winston", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/winston", "author": { "name": "Alexis Sellier", "email": "self@cloudhead.net" diff --git a/docs/snippets/node_modules/fd/package.json b/docs/snippets/node_modules/fd/package.json index f81abf15..dce33d90 100644 --- a/docs/snippets/node_modules/fd/package.json +++ b/docs/snippets/node_modules/fd/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/fd/-/fd-0.0.3.tgz", "_shasum": "b3240de86dbf5a345baae7382a07d4713566ff0c", "_spec": "fd@~0.0.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/st", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/st", "authors": [ "Rod Vagg (https://github.com/rvagg)" ], diff --git a/docs/snippets/node_modules/fflate-unzip/package.json b/docs/snippets/node_modules/fflate-unzip/package.json index 7b48978b..30dd9c5c 100644 --- a/docs/snippets/node_modules/fflate-unzip/package.json +++ b/docs/snippets/node_modules/fflate-unzip/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/fflate-unzip/-/fflate-unzip-0.6.0.tgz", "_shasum": "d300cbee98820fbe9fbce31c934a0bae76d69881", "_spec": "fflate-unzip@^0.6.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "browser": "src/index.ts", "bundleDependencies": false, "dependencies": { diff --git a/docs/snippets/node_modules/fflate/package.json b/docs/snippets/node_modules/fflate/package.json index a8e48f23..a4f27086 100644 --- a/docs/snippets/node_modules/fflate/package.json +++ b/docs/snippets/node_modules/fflate/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/fflate/-/fflate-0.6.10.tgz", "_shasum": "5f40f9659205936a2d18abf88b2e7781662b6d43", "_spec": "fflate@^0.6.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/fflate-unzip", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/fflate-unzip", "alias": { "react": "preact/compat", "react-dom": "preact/compat", diff --git a/docs/snippets/node_modules/finalhandler/package.json b/docs/snippets/node_modules/finalhandler/package.json index 2b26bd62..10efb255 100644 --- a/docs/snippets/node_modules/finalhandler/package.json +++ b/docs/snippets/node_modules/finalhandler/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", "_shasum": "b7e7d000ffd11938d0fdb053506f6ebabe9f587d", "_spec": "finalhandler@~1.1.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "Douglas Christopher Wilson", "email": "doug@somethingdoug.com" diff --git a/docs/snippets/node_modules/find/package.json b/docs/snippets/node_modules/find/package.json index e74ba4df..d42cbc1d 100644 --- a/docs/snippets/node_modules/find/package.json +++ b/docs/snippets/node_modules/find/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/find/-/find-0.3.0.tgz", "_shasum": "4082e8fc8d8320f1a382b5e4f521b9bc50775cb8", "_spec": "find@^0.3.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "yuanchuan", "email": "yuanchuan23@gmail.com", diff --git a/docs/snippets/node_modules/foreach/package.json b/docs/snippets/node_modules/foreach/package.json index 1a5a7b3c..d3deb439 100644 --- a/docs/snippets/node_modules/foreach/package.json +++ b/docs/snippets/node_modules/foreach/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", "_shasum": "0bee005018aeb260d0a3af3ae658dd0136ec1b99", "_spec": "foreach@^2.0.5", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/is-typed-array", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/is-typed-array", "author": { "name": "Manuel Stofer", "email": "manuel@takimata.ch" diff --git a/docs/snippets/node_modules/forwarded/package.json b/docs/snippets/node_modules/forwarded/package.json index 7d9f634e..411c2f6a 100644 --- a/docs/snippets/node_modules/forwarded/package.json +++ b/docs/snippets/node_modules/forwarded/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "_shasum": "2269936428aad4c15c7ebe9779a84bf0b2a81811", "_spec": "forwarded@0.2.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/proxy-addr", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/proxy-addr", "bugs": { "url": "https://github.com/jshttp/forwarded/issues" }, diff --git a/docs/snippets/node_modules/fresh/package.json b/docs/snippets/node_modules/fresh/package.json index 944cb154..f98a1a84 100644 --- a/docs/snippets/node_modules/fresh/package.json +++ b/docs/snippets/node_modules/fresh/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "_shasum": "3d8cadd90d976569fa835ab1f8e4b23a105605a7", "_spec": "fresh@0.5.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/express", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/express", "author": { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca", diff --git a/docs/snippets/node_modules/fs.realpath/package.json b/docs/snippets/node_modules/fs.realpath/package.json index 9a6690b8..01cb6de8 100644 --- a/docs/snippets/node_modules/fs.realpath/package.json +++ b/docs/snippets/node_modules/fs.realpath/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "_shasum": "1504ad2523158caa40db4a2787cb01411994ea4f", "_spec": "fs.realpath@^1.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/glob", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/glob", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", diff --git a/docs/snippets/node_modules/function-bind/package.json b/docs/snippets/node_modules/function-bind/package.json index 415be9a8..b628d83b 100644 --- a/docs/snippets/node_modules/function-bind/package.json +++ b/docs/snippets/node_modules/function-bind/package.json @@ -20,13 +20,12 @@ "/es-abstract", "/get-intrinsic", "/has", - "/unbox-primitive", - "/which-typed-array" + "/unbox-primitive" ], "_resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "_shasum": "a56899d3ea3c9bab874bb9773b7c5ede92f4895d", "_spec": "function-bind@^1.1.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/call-bind", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/call-bind", "author": { "name": "Raynos", "email": "raynos2@gmail.com" diff --git a/docs/snippets/node_modules/get-intrinsic/package.json b/docs/snippets/node_modules/get-intrinsic/package.json index 36f82562..c47abf37 100644 --- a/docs/snippets/node_modules/get-intrinsic/package.json +++ b/docs/snippets/node_modules/get-intrinsic/package.json @@ -17,12 +17,15 @@ }, "_requiredBy": [ "/call-bind", - "/es-abstract" + "/es-abstract", + "/get-symbol-description", + "/internal-slot", + "/side-channel" ], "_resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", "_shasum": "15f59f376f855c446963948f0d24cd3637b4abc6", "_spec": "get-intrinsic@^1.0.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/call-bind", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/call-bind", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" diff --git a/docs/snippets/node_modules/get-symbol-description/.eslintignore b/docs/snippets/node_modules/get-symbol-description/.eslintignore new file mode 100644 index 00000000..404abb22 --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/docs/snippets/node_modules/get-symbol-description/.eslintrc b/docs/snippets/node_modules/get-symbol-description/.eslintrc new file mode 100644 index 00000000..e824dabc --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/.eslintrc @@ -0,0 +1,14 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/docs/snippets/node_modules/get-symbol-description/.github/FUNDING.yml b/docs/snippets/node_modules/get-symbol-description/.github/FUNDING.yml new file mode 100644 index 00000000..499729c5 --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/symbol-description +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/docs/snippets/node_modules/get-symbol-description/.nycrc b/docs/snippets/node_modules/get-symbol-description/.nycrc new file mode 100644 index 00000000..bdd626ce --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/docs/snippets/node_modules/get-symbol-description/CHANGELOG.md b/docs/snippets/node_modules/get-symbol-description/CHANGELOG.md new file mode 100644 index 00000000..1e1c0794 --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2021-08-17 + +### Commits + +- Initial commit: pulled from es-abstract [`6e34a05`](https://github.com/inspect-js/get-symbol-description/commit/6e34a05ef10ce8620078cf4cecbe276c1fc1ae77) +- Initial commit [`3862092`](https://github.com/inspect-js/get-symbol-description/commit/3862092248d8ffa071ec90ec39d73e8be14ba6f1) +- [meta] do not publish github action workflow files [`9d1e2b9`](https://github.com/inspect-js/get-symbol-description/commit/9d1e2b94dd97664da5d0666985a3695c23f45865) +- npm init [`5051b32`](https://github.com/inspect-js/get-symbol-description/commit/5051b3221829f364c44b4d5e9a0c35aab3247f6a) +- Only apps should have lockfiles [`b866d1c`](https://github.com/inspect-js/get-symbol-description/commit/b866d1c4b4029277618d968cfb3cbe00f012d1a7) diff --git a/docs/snippets/node_modules/get-symbol-description/LICENSE b/docs/snippets/node_modules/get-symbol-description/LICENSE new file mode 100644 index 00000000..7948bc02 --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/snippets/node_modules/get-symbol-description/getInferredName.js b/docs/snippets/node_modules/get-symbol-description/getInferredName.js new file mode 100644 index 00000000..2dab6e77 --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/getInferredName.js @@ -0,0 +1,10 @@ +'use strict'; + +var getInferredName; +try { + // eslint-disable-next-line no-new-func + getInferredName = Function('s', 'return { [s]() {} }[s].name;'); +} catch (e) {} + +var inferred = function () {}; +module.exports = getInferredName && inferred.name === 'inferred' ? getInferredName : null; diff --git a/docs/snippets/node_modules/get-symbol-description/index.js b/docs/snippets/node_modules/get-symbol-description/index.js new file mode 100644 index 00000000..05d067fc --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/index.js @@ -0,0 +1,43 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var callBound = require('call-bind/callBound'); + +var $SyntaxError = GetIntrinsic('%SyntaxError%'); +var getGlobalSymbolDescription = GetIntrinsic('%Symbol.keyFor%', true); +var thisSymbolValue = callBound('%Symbol.prototype.valueOf%', true); +var symToStr = callBound('Symbol.prototype.toString', true); + +var getInferredName = require('./getInferredName'); + +/* eslint-disable consistent-return */ +module.exports = callBound('%Symbol.prototype.description%', true) || function getSymbolDescription(symbol) { + if (!thisSymbolValue) { + throw new $SyntaxError('Symbols are not supported in this environment'); + } + + // will throw if not a symbol primitive or wrapper object + var sym = thisSymbolValue(symbol); + + if (getInferredName) { + var name = getInferredName(sym); + if (name === '') { + return; + } + return name.slice(1, -1); // name.slice('['.length, -']'.length); + } + + var desc; + if (getGlobalSymbolDescription) { + desc = getGlobalSymbolDescription(sym); + if (typeof desc === 'string') { + return desc; + } + } + + desc = symToStr(sym).slice(7, -1); // str.slice('Symbol('.length, -')'.length); + if (desc) { + return desc; + } +}; diff --git a/docs/snippets/node_modules/get-symbol-description/package.json b/docs/snippets/node_modules/get-symbol-description/package.json new file mode 100644 index 00000000..ac8e2109 --- /dev/null +++ b/docs/snippets/node_modules/get-symbol-description/package.json @@ -0,0 +1,99 @@ +{ + "_from": "get-symbol-description@^1.0.0", + "_id": "get-symbol-description@1.0.0", + "_inBundle": false, + "_integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "_location": "/get-symbol-description", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "get-symbol-description@^1.0.0", + "name": "get-symbol-description", + "escapedName": "get-symbol-description", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/es-abstract" + ], + "_resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "_shasum": "7fdb81c900101fbd564dd5f1a30af5aadc1e58d6", + "_spec": "get-symbol-description@^1.0.0", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "bugs": { + "url": "https://github.com/inspect-js/get-symbol-description/issues" + }, + "bundleDependencies": false, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "deprecated": false, + "description": "Gets the description of a Symbol. Handles `Symbol()` vs `Symbol('')` properly when possible.", + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "es-value-fixtures": "^1.2.1", + "eslint": "^7.32.0", + "evalmd": "^0.0.19", + "foreach": "^2.0.5", + "has": "^1.0.3", + "nyc": "^10.3.2", + "object-inspect": "^1.11.0", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.1" + }, + "engines": { + "node": ">= 0.4" + }, + "exports": { + ".": "./index.js", + "./getInferredName": "./getInferredName.js", + "./package.json": "./package.json" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "homepage": "https://github.com/inspect-js/get-symbol-description#readme", + "keywords": [ + "symbol", + "ecmascript", + "javascript", + "description" + ], + "license": "MIT", + "main": "index.js", + "name": "get-symbol-description", + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/get-symbol-description.git" + }, + "scripts": { + "lint": "eslint --ext=.js,.mjs .", + "postlint": "evalmd README.md", + "posttest": "aud --production", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "version": "auto-changelog && git add CHANGELOG.md" + }, + "version": "1.0.0" +} diff --git a/docs/snippets/node_modules/es-abstract/test/helpers/getSymbolDescription.js b/docs/snippets/node_modules/get-symbol-description/test/index.js similarity index 92% rename from docs/snippets/node_modules/es-abstract/test/helpers/getSymbolDescription.js rename to docs/snippets/node_modules/get-symbol-description/test/index.js index 05be3bbb..d5363c2b 100644 --- a/docs/snippets/node_modules/es-abstract/test/helpers/getSymbolDescription.js +++ b/docs/snippets/node_modules/get-symbol-description/test/index.js @@ -4,10 +4,10 @@ var test = require('tape'); var debug = require('object-inspect'); var forEach = require('foreach'); var has = require('has'); - var v = require('es-value-fixtures'); -var getSymbolDescription = require('../../helpers/getSymbolDescription'); -var getInferredName = require('../../helpers/getInferredName'); + +var getSymbolDescription = require('../'); +var getInferredName = require('../getInferredName'); test('getSymbolDescription', function (t) { t.test('no symbols', { skip: v.hasSymbols }, function (st) { diff --git a/docs/snippets/node_modules/glob/changelog.md b/docs/snippets/node_modules/glob/changelog.md deleted file mode 100644 index 41636771..00000000 --- a/docs/snippets/node_modules/glob/changelog.md +++ /dev/null @@ -1,67 +0,0 @@ -## 7.0 - -- Raise error if `options.cwd` is specified, and not a directory - -## 6.0 - -- Remove comment and negation pattern support -- Ignore patterns are always in `dot:true` mode - -## 5.0 - -- Deprecate comment and negation patterns -- Fix regression in `mark` and `nodir` options from making all cache - keys absolute path. -- Abort if `fs.readdir` returns an error that's unexpected -- Don't emit `match` events for ignored items -- Treat ENOTSUP like ENOTDIR in readdir - -## 4.5 - -- Add `options.follow` to always follow directory symlinks in globstar -- Add `options.realpath` to call `fs.realpath` on all results -- Always cache based on absolute path - -## 4.4 - -- Add `options.ignore` -- Fix handling of broken symlinks - -## 4.3 - -- Bump minimatch to 2.x -- Pass all tests on Windows - -## 4.2 - -- Add `glob.hasMagic` function -- Add `options.nodir` flag - -## 4.1 - -- Refactor sync and async implementations for performance -- Throw if callback provided to sync glob function -- Treat symbolic links in globstar results the same as Bash 4.3 - -## 4.0 - -- Use `^` for dependency versions (bumped major because this breaks - older npm versions) -- Ensure callbacks are only ever called once -- switch to ISC license - -## 3.x - -- Rewrite in JavaScript -- Add support for setting root, cwd, and windows support -- Cache many fs calls -- Add globstar support -- emit match events - -## 2.x - -- Use `glob.h` and `fnmatch.h` from NetBSD - -## 1.x - -- `glob.h` static binding. diff --git a/docs/snippets/node_modules/glob/common.js b/docs/snippets/node_modules/glob/common.js index d14157a0..8e363b6c 100644 --- a/docs/snippets/node_modules/glob/common.js +++ b/docs/snippets/node_modules/glob/common.js @@ -10,6 +10,7 @@ function ownProp (obj, field) { return Object.prototype.hasOwnProperty.call(obj, field) } +var fs = require("fs") var path = require("path") var minimatch = require("minimatch") var isAbsolute = require("path-is-absolute") @@ -75,6 +76,7 @@ function setopts (self, pattern, options) { self.stat = !!options.stat self.noprocess = !!options.noprocess self.absolute = !!options.absolute + self.fs = options.fs || fs self.maxLength = options.maxLength || Infinity self.cache = options.cache || Object.create(null) diff --git a/docs/snippets/node_modules/glob/glob.js b/docs/snippets/node_modules/glob/glob.js index dc27aef1..afcf8275 100644 --- a/docs/snippets/node_modules/glob/glob.js +++ b/docs/snippets/node_modules/glob/glob.js @@ -40,7 +40,6 @@ module.exports = glob -var fs = require('fs') var rp = require('fs.realpath') var minimatch = require('minimatch') var Minimatch = minimatch.Minimatch @@ -501,7 +500,7 @@ Glob.prototype._readdirInGlobStar = function (abs, cb) { var lstatcb = inflight(lstatkey, lstatcb_) if (lstatcb) - fs.lstat(abs, lstatcb) + self.fs.lstat(abs, lstatcb) function lstatcb_ (er, lstat) { if (er && er.code === 'ENOENT') @@ -542,7 +541,7 @@ Glob.prototype._readdir = function (abs, inGlobStar, cb) { } var self = this - fs.readdir(abs, readdirCb(this, abs, cb)) + self.fs.readdir(abs, readdirCb(this, abs, cb)) } function readdirCb (self, abs, cb) { @@ -746,13 +745,13 @@ Glob.prototype._stat = function (f, cb) { var self = this var statcb = inflight('stat\0' + abs, lstatcb_) if (statcb) - fs.lstat(abs, statcb) + self.fs.lstat(abs, statcb) function lstatcb_ (er, lstat) { if (lstat && lstat.isSymbolicLink()) { // If it's a symlink, then treat it as the target, unless // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { + return self.fs.stat(abs, function (er, stat) { if (er) self._stat2(f, abs, null, lstat, cb) else diff --git a/docs/snippets/node_modules/glob/package.json b/docs/snippets/node_modules/glob/package.json index a45c8265..3c1a70b7 100644 --- a/docs/snippets/node_modules/glob/package.json +++ b/docs/snippets/node_modules/glob/package.json @@ -1,8 +1,8 @@ { "_from": "glob@^7.1.3", - "_id": "glob@7.1.7", + "_id": "glob@7.2.0", "_inBundle": false, - "_integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "_integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "_location": "/glob", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/jscoq" ], - "_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "_shasum": "3b193e9233f01d42d0b3f78294bbeeb418f94a90", + "_resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "_shasum": "d15535af7732e02e948f4c41628bd910293f6023", "_spec": "glob@^7.1.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -42,6 +42,7 @@ "deprecated": false, "description": "a little globber", "devDependencies": { + "memfs": "^3.2.0", "mkdirp": "0", "rimraf": "^2.2.8", "tap": "^15.0.6", @@ -80,5 +81,5 @@ "after": "test/zz-cleanup.js", "jobs": 1 }, - "version": "7.1.7" + "version": "7.2.0" } diff --git a/docs/snippets/node_modules/glob/sync.js b/docs/snippets/node_modules/glob/sync.js index 10b0ed2c..4f46f905 100644 --- a/docs/snippets/node_modules/glob/sync.js +++ b/docs/snippets/node_modules/glob/sync.js @@ -1,7 +1,6 @@ module.exports = globSync globSync.GlobSync = GlobSync -var fs = require('fs') var rp = require('fs.realpath') var minimatch = require('minimatch') var Minimatch = minimatch.Minimatch @@ -246,7 +245,7 @@ GlobSync.prototype._readdirInGlobStar = function (abs) { var lstat var stat try { - lstat = fs.lstatSync(abs) + lstat = this.fs.lstatSync(abs) } catch (er) { if (er.code === 'ENOENT') { // lstat failed, doesn't exist @@ -283,7 +282,7 @@ GlobSync.prototype._readdir = function (abs, inGlobStar) { } try { - return this._readdirEntries(abs, fs.readdirSync(abs)) + return this._readdirEntries(abs, this.fs.readdirSync(abs)) } catch (er) { this._readdirError(abs, er) return null @@ -442,7 +441,7 @@ GlobSync.prototype._stat = function (f) { if (!stat) { var lstat try { - lstat = fs.lstatSync(abs) + lstat = this.fs.lstatSync(abs) } catch (er) { if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { this.statCache[abs] = false @@ -452,7 +451,7 @@ GlobSync.prototype._stat = function (f) { if (lstat && lstat.isSymbolicLink()) { try { - stat = fs.statSync(abs) + stat = this.fs.statSync(abs) } catch (er) { stat = lstat } diff --git a/docs/snippets/node_modules/graceful-fs/graceful-fs.js b/docs/snippets/node_modules/graceful-fs/graceful-fs.js index e15042da..947cd94b 100644 --- a/docs/snippets/node_modules/graceful-fs/graceful-fs.js +++ b/docs/snippets/node_modules/graceful-fs/graceful-fs.js @@ -54,7 +54,7 @@ if (!fs[gracefulQueue]) { return fs$close.call(fs, fd, function (err) { // This function uses the graceful-fs shared queue if (!err) { - retry() + resetQueue() } if (typeof cb === 'function') @@ -72,7 +72,7 @@ if (!fs[gracefulQueue]) { function closeSync (fd) { // This function uses the graceful-fs shared queue fs$closeSync.apply(fs, arguments) - retry() + resetQueue() } Object.defineProperty(closeSync, previousSymbol, { @@ -114,14 +114,13 @@ function patch (fs) { return go$readFile(path, options, cb) - function go$readFile (path, options, cb) { + function go$readFile (path, options, cb, startTime) { return fs$readFile(path, options, function (err) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readFile, [path, options, cb]]) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -135,14 +134,13 @@ function patch (fs) { return go$writeFile(path, data, options, cb) - function go$writeFile (path, data, options, cb) { + function go$writeFile (path, data, options, cb, startTime) { return fs$writeFile(path, data, options, function (err) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$writeFile, [path, data, options, cb]]) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -157,14 +155,13 @@ function patch (fs) { return go$appendFile(path, data, options, cb) - function go$appendFile (path, data, options, cb) { + function go$appendFile (path, data, options, cb, startTime) { return fs$appendFile(path, data, options, function (err) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$appendFile, [path, data, options, cb]]) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -178,49 +175,43 @@ function patch (fs) { cb = flags flags = 0 } - return fs$copyFile(src, dest, flags, function (err) { - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([fs$copyFile, [src, dest, flags, cb]]) - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } - }) + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } } var fs$readdir = fs.readdir fs.readdir = readdir function readdir (path, options, cb) { - var args = [path] - if (typeof options !== 'function') { - args.push(options) - } else { - cb = options - } - args.push(go$readdir$cb) - - return go$readdir(args) + if (typeof options === 'function') + cb = options, options = null - function go$readdir$cb (err, files) { - if (files && files.sort) - files.sort() + return go$readdir(path, options, cb) - if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$readdir, [args]]) + function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readdir, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (files && files.sort) + files.sort() - else { - if (typeof cb === 'function') - cb.apply(this, arguments) - retry() - } + if (typeof cb === 'function') + cb.call(this, err, files) + } + }) } } - function go$readdir (args) { - return fs$readdir.apply(fs, args) - } - if (process.version.substr(0, 4) === 'v0.8') { var legStreams = legacy(fs) ReadStream = legStreams.ReadStream @@ -343,14 +334,13 @@ function patch (fs) { return go$open(path, flags, mode, cb) - function go$open (path, flags, mode, cb) { + function go$open (path, flags, mode, cb, startTime) { return fs$open(path, flags, mode, function (err, fd) { if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) - enqueue([go$open, [path, flags, mode, cb]]) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) else { if (typeof cb === 'function') cb.apply(this, arguments) - retry() } }) } @@ -362,12 +352,78 @@ function patch (fs) { function enqueue (elem) { debug('ENQUEUE', elem[0].name, elem[1]) fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() } function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + var elem = fs[gracefulQueue].shift() - if (elem) { - debug('RETRY', elem[0].name, elem[1]) - elem[0].apply(null, elem[1]) + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) } } diff --git a/docs/snippets/node_modules/graceful-fs/package.json b/docs/snippets/node_modules/graceful-fs/package.json index 9c6235d0..59c08d10 100644 --- a/docs/snippets/node_modules/graceful-fs/package.json +++ b/docs/snippets/node_modules/graceful-fs/package.json @@ -1,8 +1,8 @@ { "_from": "graceful-fs@^4.2.3", - "_id": "graceful-fs@4.2.6", + "_id": "graceful-fs@4.2.8", "_inBundle": false, - "_integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "_integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "_location": "/graceful-fs", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/st" ], - "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "_shasum": "ff040b2b0853b23c3d31027523706f1885d76bee", + "_resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "_shasum": "e412b8d33f5e006593cbd3cee6df9f2cebbe802a", "_spec": "graceful-fs@^4.2.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/st", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/st", "bugs": { "url": "https://github.com/isaacs/node-graceful-fs/issues" }, @@ -75,5 +75,5 @@ "preversion": "npm test", "test": "nyc --silent node test.js | tap -c -" }, - "version": "4.2.6" + "version": "4.2.8" } diff --git a/docs/snippets/node_modules/has-bigints/package.json b/docs/snippets/node_modules/has-bigints/package.json index 0ba4f65a..56421cca 100644 --- a/docs/snippets/node_modules/has-bigints/package.json +++ b/docs/snippets/node_modules/has-bigints/package.json @@ -16,12 +16,13 @@ "fetchSpec": "^1.0.1" }, "_requiredBy": [ + "/is-bigint", "/unbox-primitive" ], "_resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", "_shasum": "64fe6acb020673e3b78db035a5af69aa9d07b113", "_spec": "has-bigints@^1.0.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/unbox-primitive", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/unbox-primitive", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" diff --git a/docs/snippets/node_modules/has-symbols/package.json b/docs/snippets/node_modules/has-symbols/package.json index 6065dd04..9ac00d86 100644 --- a/docs/snippets/node_modules/has-symbols/package.json +++ b/docs/snippets/node_modules/has-symbols/package.json @@ -18,17 +18,15 @@ "_requiredBy": [ "/es-abstract", "/get-intrinsic", - "/is-regex", + "/has-tostringtag", "/is-symbol", - "/is-typed-array", "/object.assign", - "/unbox-primitive", - "/which-typed-array" + "/unbox-primitive" ], "_resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", "_shasum": "165d3070c00309752a1236a479331e3ac56f1423", "_spec": "has-symbols@^1.0.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/get-intrinsic", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/get-intrinsic", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", diff --git a/docs/snippets/node_modules/has-tostringtag/.eslintrc b/docs/snippets/node_modules/has-tostringtag/.eslintrc new file mode 100644 index 00000000..2d9a66a8 --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/.eslintrc @@ -0,0 +1,11 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-statements-per-line": [2, { "max": 2 }], + "no-magic-numbers": 0, + "multiline-comment-style": 0, + } +} diff --git a/docs/snippets/node_modules/has-tostringtag/.github/FUNDING.yml b/docs/snippets/node_modules/has-tostringtag/.github/FUNDING.yml new file mode 100644 index 00000000..7a450e70 --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-tostringtag +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/docs/snippets/node_modules/has-tostringtag/CHANGELOG.md b/docs/snippets/node_modules/has-tostringtag/CHANGELOG.md new file mode 100644 index 00000000..39fb77cf --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/CHANGELOG.md @@ -0,0 +1,20 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2021-08-05 + +### Commits + +- Tests [`6b6f573`](https://github.com/inspect-js/has-tostringtag/commit/6b6f5734dc2058badb300ff0783efdad95fe1a65) +- Initial commit [`2f8190e`](https://github.com/inspect-js/has-tostringtag/commit/2f8190e799fac32ba9b95a076c0255e01d7ce475) +- [meta] do not publish github action workflow files [`6e08cc4`](https://github.com/inspect-js/has-tostringtag/commit/6e08cc4e0fea7ec71ef66e70734b2af2c4a8b71b) +- readme [`94bed6c`](https://github.com/inspect-js/has-tostringtag/commit/94bed6c9560cbbfda034f8d6c260bb7b0db33c1a) +- npm init [`be67840`](https://github.com/inspect-js/has-tostringtag/commit/be67840ab92ee7adb98bcc65261975543f815fa5) +- Implementation [`c4914ec`](https://github.com/inspect-js/has-tostringtag/commit/c4914ecc51ddee692c85b471ae0a5d8123030fbf) +- [meta] use `auto-changelog` [`4aaf768`](https://github.com/inspect-js/has-tostringtag/commit/4aaf76895ae01d7b739f2b19f967ef2372506cd7) +- Only apps should have lockfiles [`bc4d99e`](https://github.com/inspect-js/has-tostringtag/commit/bc4d99e4bf494afbaa235c5f098df6e642edf724) +- [meta] add `safe-publish-latest` [`6523c05`](https://github.com/inspect-js/has-tostringtag/commit/6523c05c9b87140f3ae74c9daf91633dd9ff4e1f) diff --git a/docs/snippets/node_modules/has-tostringtag/LICENSE b/docs/snippets/node_modules/has-tostringtag/LICENSE new file mode 100644 index 00000000..7948bc02 --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/snippets/node_modules/has-tostringtag/index.js b/docs/snippets/node_modules/has-tostringtag/index.js new file mode 100644 index 00000000..d626b7a8 --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/index.js @@ -0,0 +1,7 @@ +'use strict'; + +var hasSymbols = require('has-symbols'); + +module.exports = function hasToStringTag() { + return hasSymbols() && typeof Symbol.toStringTag === 'symbol'; +}; diff --git a/docs/snippets/node_modules/has-tostringtag/package.json b/docs/snippets/node_modules/has-tostringtag/package.json new file mode 100644 index 00000000..4793675b --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/package.json @@ -0,0 +1,117 @@ +{ + "_from": "has-tostringtag@^1.0.0", + "_id": "has-tostringtag@1.0.0", + "_inBundle": false, + "_integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "_location": "/has-tostringtag", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "has-tostringtag@^1.0.0", + "name": "has-tostringtag", + "escapedName": "has-tostringtag", + "rawSpec": "^1.0.0", + "saveSpec": null, + "fetchSpec": "^1.0.0" + }, + "_requiredBy": [ + "/is-arguments", + "/is-boolean-object", + "/is-date-object", + "/is-generator-function", + "/is-number-object", + "/is-regex", + "/is-string", + "/is-typed-array", + "/which-typed-array" + ], + "_resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "_shasum": "7e133818a7d394734f941e73c3d3f9291e658b25", + "_spec": "has-tostringtag@^1.0.0", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/is-arguments", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "bugs": { + "url": "https://github.com/inspect-js/has-tostringtag/issues" + }, + "bundleDependencies": false, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "dependencies": { + "has-symbols": "^1.0.2" + }, + "deprecated": false, + "description": "Determine if the JS environment has `Symbol.toStringTag` support. Supports spec, or shams.", + "devDependencies": { + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "core-js": "^2.6.12", + "eslint": "^7.32.0", + "get-own-property-symbols": "^0.9.5", + "nyc": "^10.3.2", + "safe-publish-latest": "^1.1.4", + "tape": "^5.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "exports": { + ".": "./index.js", + "./shams": "./shams.js", + "./package.json": "./package.json" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "homepage": "https://github.com/inspect-js/has-tostringtag#readme", + "keywords": [ + "javascript", + "ecmascript", + "symbol", + "symbols", + "tostringtag", + "Symbol.toStringTag" + ], + "license": "MIT", + "main": "index.js", + "name": "has-tostringtag", + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/has-tostringtag.git" + }, + "scripts": { + "lint": "eslint --ext=js,mjs .", + "posttest": "aud --production", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run --silent lint", + "test": "npm run tests-only", + "test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs", + "test:shams:corejs": "nyc node test/shams/core-js.js", + "test:shams:getownpropertysymbols": "nyc node test/shams/get-own-property-symbols.js", + "test:staging": "nyc node --harmony --es-staging test", + "test:stock": "nyc node test", + "tests-only": "npm run test:stock && npm run test:staging && npm run test:shams", + "version": "auto-changelog && git add CHANGELOG.md" + }, + "version": "1.0.0" +} diff --git a/docs/snippets/node_modules/has-tostringtag/shams.js b/docs/snippets/node_modules/has-tostringtag/shams.js new file mode 100644 index 00000000..8b7e4011 --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/shams.js @@ -0,0 +1,7 @@ +'use strict'; + +var hasSymbols = require('has-symbols/shams'); + +module.exports = function hasToStringTagShams() { + return hasSymbols() && !!Symbol.toStringTag; +}; diff --git a/docs/snippets/node_modules/has-tostringtag/test/index.js b/docs/snippets/node_modules/has-tostringtag/test/index.js new file mode 100644 index 00000000..0679afdf --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/test/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var test = require('tape'); +var hasSymbolToStringTag = require('../'); +var runSymbolTests = require('./tests'); + +test('interface', function (t) { + t.equal(typeof hasSymbolToStringTag, 'function', 'is a function'); + t.equal(typeof hasSymbolToStringTag(), 'boolean', 'returns a boolean'); + t.end(); +}); + +test('Symbol.toStringTag exists', { skip: !hasSymbolToStringTag() }, function (t) { + runSymbolTests(t); + t.end(); +}); + +test('Symbol.toStringTag does not exist', { skip: hasSymbolToStringTag() }, function (t) { + t.equal(typeof Symbol === 'undefined' ? 'undefined' : typeof Symbol.toStringTag, 'undefined', 'global Symbol.toStringTag is undefined'); + t.end(); +}); diff --git a/docs/snippets/node_modules/has-tostringtag/test/shams/core-js.js b/docs/snippets/node_modules/has-tostringtag/test/shams/core-js.js new file mode 100644 index 00000000..692b86eb --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/test/shams/core-js.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol') { + test('has native Symbol.toStringTag support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol.toStringTag, 'symbol'); + t.end(); + }); + return; +} + +var hasSymbolToStringTag = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbolToStringTag(), false, 'hasSymbolToStringTag is false before polyfilling'); + require('core-js/fn/symbol'); + require('core-js/fn/symbol/to-string-tag'); + + require('../tests')(t); + + var hasToStringTagAfter = hasSymbolToStringTag(); + t.equal(hasToStringTagAfter, true, 'hasSymbolToStringTag is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/docs/snippets/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js b/docs/snippets/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js new file mode 100644 index 00000000..489fe836 --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js @@ -0,0 +1,28 @@ +'use strict'; + +var test = require('tape'); + +if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') { + test('has native Symbol support', function (t) { + t.equal(typeof Symbol, 'function'); + t.equal(typeof Symbol(), 'symbol'); + t.end(); + }); + return; +} + +var hasSymbolToStringTag = require('../../shams'); + +test('polyfilled Symbols', function (t) { + /* eslint-disable global-require */ + t.equal(hasSymbolToStringTag(), false, 'hasSymbolToStringTag is false before polyfilling'); + + require('get-own-property-symbols'); + + require('../tests')(t); + + var hasToStringTagAfter = hasSymbolToStringTag(); + t.equal(hasToStringTagAfter, true, 'hasSymbolToStringTag is true after polyfilling'); + /* eslint-enable global-require */ + t.end(); +}); diff --git a/docs/snippets/node_modules/has-tostringtag/test/tests.js b/docs/snippets/node_modules/has-tostringtag/test/tests.js new file mode 100644 index 00000000..0dae885c --- /dev/null +++ b/docs/snippets/node_modules/has-tostringtag/test/tests.js @@ -0,0 +1,14 @@ +'use strict'; + +// eslint-disable-next-line consistent-return +module.exports = function runSymbolTests(t) { + t.equal(typeof Symbol, 'function', 'global Symbol is a function'); + t.ok(Symbol.toStringTag, 'Symbol.toStringTag exists'); + + if (typeof Symbol !== 'function' || !Symbol.toStringTag) { return false; } + + var obj = {}; + obj[Symbol.toStringTag] = 'test'; + + t.equal(Object.prototype.toString.call(obj), '[object test]'); +}; diff --git a/docs/snippets/node_modules/has/package.json b/docs/snippets/node_modules/has/package.json index 1a1793b6..ed8f031d 100644 --- a/docs/snippets/node_modules/has/package.json +++ b/docs/snippets/node_modules/has/package.json @@ -17,12 +17,13 @@ }, "_requiredBy": [ "/es-abstract", - "/get-intrinsic" + "/get-intrinsic", + "/internal-slot" ], "_resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "_shasum": "722d7cbfc1f6aa8241f16dd814e011e1f41e8796", "_spec": "has@^1.0.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/get-intrinsic", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/get-intrinsic", "author": { "name": "Thiago de Arruda", "email": "tpadilha84@gmail.com" diff --git a/docs/snippets/node_modules/highlight.js/package.json b/docs/snippets/node_modules/highlight.js/package.json index df262988..c165187c 100644 --- a/docs/snippets/node_modules/highlight.js/package.json +++ b/docs/snippets/node_modules/highlight.js/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", "_shasum": "697272e3991356e40c3cac566a74eef681756531", "_spec": "highlight.js@^10.5.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/@corwin.amber/hastebin", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/@corwin.amber/hastebin", "author": { "name": "Ivan Sagalaev", "email": "maniac@softwaremaniacs.org" diff --git a/docs/snippets/node_modules/http-errors/package.json b/docs/snippets/node_modules/http-errors/package.json index b3b902a6..d148eaf2 100644 --- a/docs/snippets/node_modules/http-errors/package.json +++ b/docs/snippets/node_modules/http-errors/package.json @@ -23,7 +23,7 @@ "_resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", "_shasum": "4f5029cf13239f31036e5b2e55292bcfbcc85c8f", "_spec": "http-errors@1.7.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/body-parser", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/body-parser", "author": { "name": "Jonathan Ong", "email": "me@jongleberry.com", diff --git a/docs/snippets/node_modules/iconv-lite/package.json b/docs/snippets/node_modules/iconv-lite/package.json index 9802eedf..30b72573 100644 --- a/docs/snippets/node_modules/iconv-lite/package.json +++ b/docs/snippets/node_modules/iconv-lite/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "_shasum": "2022b4b25fbddc21d2f524974a474aafe733908b", "_spec": "iconv-lite@0.4.24", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/body-parser", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/body-parser", "author": { "name": "Alexander Shtuchkin", "email": "ashtuchkin@gmail.com" diff --git a/docs/snippets/node_modules/ieee754/package.json b/docs/snippets/node_modules/ieee754/package.json index a1462d7a..02c8b26a 100644 --- a/docs/snippets/node_modules/ieee754/package.json +++ b/docs/snippets/node_modules/ieee754/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "_shasum": "8eb7a10a63fff25d15a57b001586d177d1b0d352", "_spec": "ieee754@^1.1.13", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/buffer", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/buffer", "author": { "name": "Feross Aboukhadijeh", "email": "feross@feross.org", diff --git a/docs/snippets/node_modules/immediate/package.json b/docs/snippets/node_modules/immediate/package.json index cf4eb881..23c4e190 100644 --- a/docs/snippets/node_modules/immediate/package.json +++ b/docs/snippets/node_modules/immediate/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", "_shasum": "9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b", "_spec": "immediate@~3.0.5", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/lie", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/lie", "browser": { "./lib/index.js": "./lib/browser.js" }, diff --git a/docs/snippets/node_modules/inflight/package.json b/docs/snippets/node_modules/inflight/package.json index 61e4b975..95ace920 100644 --- a/docs/snippets/node_modules/inflight/package.json +++ b/docs/snippets/node_modules/inflight/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9", "_spec": "inflight@^1.0.4", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/glob", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/glob", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", diff --git a/docs/snippets/node_modules/inherits/package.json b/docs/snippets/node_modules/inherits/package.json index e47919f6..3abc4f5c 100644 --- a/docs/snippets/node_modules/inherits/package.json +++ b/docs/snippets/node_modules/inherits/package.json @@ -27,7 +27,7 @@ "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "_shasum": "633c2c83e3da42a502f52466022480f4208261de", "_spec": "inherits@2.0.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/http-errors", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/http-errors", "browser": "./inherits_browser.js", "bugs": { "url": "https://github.com/isaacs/inherits/issues" diff --git a/docs/snippets/node_modules/localforage/bower_components/modernizr/.editorconfig b/docs/snippets/node_modules/internal-slot/.editorconfig similarity index 51% rename from docs/snippets/node_modules/localforage/bower_components/modernizr/.editorconfig rename to docs/snippets/node_modules/internal-slot/.editorconfig index 0f099897..bc228f82 100644 --- a/docs/snippets/node_modules/localforage/bower_components/modernizr/.editorconfig +++ b/docs/snippets/node_modules/internal-slot/.editorconfig @@ -1,10 +1,20 @@ -# editorconfig.org root = true [*] -indent_style = space -indent_size = 2 +indent_style = tab +indent_size = 4 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +max_line_length = 150 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/docs/snippets/node_modules/internal-slot/.eslintignore b/docs/snippets/node_modules/internal-slot/.eslintignore new file mode 100644 index 00000000..404abb22 --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/docs/snippets/node_modules/internal-slot/.eslintrc b/docs/snippets/node_modules/internal-slot/.eslintrc new file mode 100644 index 00000000..cab5bd09 --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/.eslintrc @@ -0,0 +1,12 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "max-params": [2, 3], + "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], + "no-magic-numbers": 0, + "operator-linebreak": [2, "before"], + }, +} diff --git a/docs/snippets/node_modules/internal-slot/.github/FUNDING.yml b/docs/snippets/node_modules/internal-slot/.github/FUNDING.yml new file mode 100644 index 00000000..8dc96e28 --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/internal-slot +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/docs/snippets/node_modules/internal-slot/.nycrc b/docs/snippets/node_modules/internal-slot/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/docs/snippets/node_modules/internal-slot/CHANGELOG.md b/docs/snippets/node_modules/internal-slot/CHANGELOG.md new file mode 100644 index 00000000..3a7a40c9 --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/CHANGELOG.md @@ -0,0 +1,58 @@ +### Changelog + +All notable changes to this project will be documented in this file. Dates are displayed in UTC. + +Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). + +#### [v1.0.3](https://github.com/ljharb/internal-slot/compare/v1.0.2...v1.0.3) + +> 26 January 2021 + +- [Tests] use shared travis-ci configs [`0ef2263`](https://github.com/ljharb/internal-slot/commit/0ef22634fa2269d9df0d784aca3c5748e8eabd3b) +- [Tests] migrate tests to Github Actions [`6253915`](https://github.com/ljharb/internal-slot/commit/6253915d28721df2eda5630849bc6b57647e3ee2) +- [meta] do not publish github action workflow files [`ef94e55`](https://github.com/ljharb/internal-slot/commit/ef94e555727ed6a649ef64010904fe89a468d459) +- [Tests] run `nyc` on all tests; use `tape` runner [`917d6ca`](https://github.com/ljharb/internal-slot/commit/917d6ca630cdcd6b4da9a2c300c6a3abb6e724fe) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`8dcb6fe`](https://github.com/ljharb/internal-slot/commit/8dcb6fe01d6a45e1af17a9dace95ca47c99b4328) +- [actions] add "Allow Edits" workflow [`7aa3e86`](https://github.com/ljharb/internal-slot/commit/7aa3e86edb0149fd882717481885760aeb28474e) +- [Refactor] use `get-intrinsic` instead of `es-abstract`; update `side-channel` [`11ad17d`](https://github.com/ljharb/internal-slot/commit/11ad17d4255adcbc55fd4eca0bf6733bac59f1bf) +- [readme] remove travis badge [`5b75452`](https://github.com/ljharb/internal-slot/commit/5b754523aa07e8f67d0135df75059a18047292bb) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`d531688`](https://github.com/ljharb/internal-slot/commit/d5316880956b4dd83e6b6c9ab48fdd8171a4a268) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`c76fa91`](https://github.com/ljharb/internal-slot/commit/c76fa91a7e623a738e22332bee4e985aea41122e) +- [Dev Deps] update `eslint`, `tape` [`e733ccd`](https://github.com/ljharb/internal-slot/commit/e733ccd68e81c72ef2e02726e001895053de7887) +- [Dev Deps] update `auto-changelog`; add `aud` [`df20bf5`](https://github.com/ljharb/internal-slot/commit/df20bf5d3943a533c20799d8cc1449997e85d53b) +- [meta] fix autochangelog [`e89e6f1`](https://github.com/ljharb/internal-slot/commit/e89e6f1ff9f10f386e6400b586db78ad9c0f1309) +- [Tests] only audit prod deps [`71317b9`](https://github.com/ljharb/internal-slot/commit/71317b95ec6bbd9877807da0c0316ee9f5f30fab) +- [Deps] update `es-abstract` [`c17ccf4`](https://github.com/ljharb/internal-slot/commit/c17ccf45f4cb0d3b7a1536e9cd3a7ff9a7dafd21) +- [Dev Deps] update `tape` [`d81ae03`](https://github.com/ljharb/internal-slot/commit/d81ae030a0e8f58cee00f752601ce60405a93d78) +- [Deps] update `es-abstract` [`b56303b`](https://github.com/ljharb/internal-slot/commit/b56303b4c3af7a510f9f51860895a46fd2e14752) +- [Deps] update `es-abstract` [`9996d1c`](https://github.com/ljharb/internal-slot/commit/9996d1cf3507750c7a6845a2fb0d0f849ea898a1) + +#### [v1.0.2](https://github.com/ljharb/internal-slot/compare/v1.0.1...v1.0.2) + +> 20 December 2019 + +- [Deps] update `es-abstract`, `side-channel` [`5c9df03`](https://github.com/ljharb/internal-slot/commit/5c9df03a25518f5c482cff4e1447a26fa071df9a) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`7820f98`](https://github.com/ljharb/internal-slot/commit/7820f984e523a64ddf3068c4e5631abf61eb1ea4) + +#### [v1.0.1](https://github.com/ljharb/internal-slot/compare/v1.0.0...v1.0.1) + +> 1 December 2019 + +- [Refactor] use `side-channel` package [`d38639f`](https://github.com/ljharb/internal-slot/commit/d38639f0a3cdb5090711179d0e78df857ecbd5d3) +- [actions] add automatic rebasing / merge commit blocking [`74267e6`](https://github.com/ljharb/internal-slot/commit/74267e6e591e18ba39186cb99139d3fd7a757c9f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest` [`b042eef`](https://github.com/ljharb/internal-slot/commit/b042eefc067b830bbd370833f7f21754e802b0b2) +- [Deps] update `es-abstract` [`98cf4e8`](https://github.com/ljharb/internal-slot/commit/98cf4e86c1bfe99eda7b11a8ea70394368f33e4f) + +#### v1.0.0 + +> 20 October 2019 + +- Tests [`b50fa41`](https://github.com/ljharb/internal-slot/commit/b50fa41b6f47aba39ac4cb733658580974a0b00a) +- implementation [`c5a59f3`](https://github.com/ljharb/internal-slot/commit/c5a59f3753677f81aa12a0226d3b1187846d06dd) +- Initial commit [`15ebe4d`](https://github.com/ljharb/internal-slot/commit/15ebe4dc6d46885f67969d64c9c3e705780963f8) +- readme [`382a3f5`](https://github.com/ljharb/internal-slot/commit/382a3f53d8975e6488373a0fc2abcdc7c4c44247) +- npm init [`d5e7c97`](https://github.com/ljharb/internal-slot/commit/d5e7c977ef694e89c245fd11165f63c06a7a5040) +- [meta] add FUNDING.yml [`685b608`](https://github.com/ljharb/internal-slot/commit/685b6087613f6735f4411a558500d92f8a3ec3f2) +- [meta] add `auto-changelog`, `safe-publish-latest` [`f8fdf1c`](https://github.com/ljharb/internal-slot/commit/f8fdf1c3f0c592f71746da6d7f8bea18f8946dda) +- [Tests] add `npm run lint` [`baaaa09`](https://github.com/ljharb/internal-slot/commit/baaaa09ab6e5bc5fcc0e7c76e10c55aa18f4ca7e) +- Only apps should have lockfiles [`dfa7efa`](https://github.com/ljharb/internal-slot/commit/dfa7efa3d5cd23261cb75c2adab6ee3c06790fee) diff --git a/docs/snippets/node_modules/internal-slot/LICENSE b/docs/snippets/node_modules/internal-slot/LICENSE new file mode 100644 index 00000000..3900dd7e --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/snippets/node_modules/internal-slot/index.js b/docs/snippets/node_modules/internal-slot/index.js new file mode 100644 index 00000000..0ed115ba --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/index.js @@ -0,0 +1,59 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var has = require('has'); +var channel = require('side-channel')(); + +var $TypeError = GetIntrinsic('%TypeError%'); + +var SLOT = { + assert: function (O, slot) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + channel.assert(O); + }, + get: function (O, slot) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + var slots = channel.get(O); + return slots && slots['$' + slot]; + }, + has: function (O, slot) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + var slots = channel.get(O); + return !!slots && has(slots, '$' + slot); + }, + set: function (O, slot, V) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new $TypeError('`O` is not an object'); + } + if (typeof slot !== 'string') { + throw new $TypeError('`slot` must be a string'); + } + var slots = channel.get(O); + if (!slots) { + slots = {}; + channel.set(O, slots); + } + slots['$' + slot] = V; + } +}; + +if (Object.freeze) { + Object.freeze(SLOT); +} + +module.exports = SLOT; diff --git a/docs/snippets/node_modules/internal-slot/package.json b/docs/snippets/node_modules/internal-slot/package.json new file mode 100644 index 00000000..2e8bf582 --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/package.json @@ -0,0 +1,91 @@ +{ + "_from": "internal-slot@^1.0.3", + "_id": "internal-slot@1.0.3", + "_inBundle": false, + "_integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "_location": "/internal-slot", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "internal-slot@^1.0.3", + "name": "internal-slot", + "escapedName": "internal-slot", + "rawSpec": "^1.0.3", + "saveSpec": null, + "fetchSpec": "^1.0.3" + }, + "_requiredBy": [ + "/es-abstract" + ], + "_resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "_shasum": "7347e307deeea2faac2ac6205d4bc7d34967f59c", + "_spec": "internal-slot@^1.0.3", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false + }, + "bugs": { + "url": "https://github.com/ljharb/internal-slot/issues" + }, + "bundleDependencies": false, + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "deprecated": false, + "description": "ES spec-like internal slots", + "devDependencies": { + "@ljharb/eslint-config": "^17.5.0", + "aud": "^1.1.3", + "auto-changelog": "^2.2.1", + "eslint": "^7.18.0", + "foreach": "^2.0.5", + "nyc": "^10.3.2", + "object-inspect": "^1.9.0", + "safe-publish-latest": "^1.1.4", + "tape": "^5.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "homepage": "https://github.com/ljharb/internal-slot#readme", + "keywords": [ + "internal", + "slot", + "internal slot", + "ecmascript", + "es", + "spec", + "private", + "data", + "private data", + "weakmap" + ], + "license": "MIT", + "main": "index.js", + "name": "internal-slot", + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/internal-slot.git" + }, + "scripts": { + "lint": "eslint .", + "posttest": "aud --production", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "prepublish": "safe-publish-latest", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "version": "auto-changelog && git add CHANGELOG.md" + }, + "version": "1.0.3" +} diff --git a/docs/snippets/node_modules/internal-slot/test/index.js b/docs/snippets/node_modules/internal-slot/test/index.js new file mode 100644 index 00000000..de65d459 --- /dev/null +++ b/docs/snippets/node_modules/internal-slot/test/index.js @@ -0,0 +1,120 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var forEach = require('foreach'); + +var SLOT = require('../'); + +test('assert', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.assert(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.assert({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + t['throws']( + function () { SLOT.assert({}, 'whatever'); }, + TypeError, + 'nonexistent slot throws' + ); + + var o = {}; + SLOT.set(o, 'x'); + t.doesNotThrow(function () { SLOT.assert(o, 'x'); }, 'existent slot noops'); + + t.end(); +}); + +test('has', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.has(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.has({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + var o = {}; + + t.equal(SLOT.has(o, 'nonexistent'), false, 'nonexistent slot yields false'); + + SLOT.set(o, 'foo'); + t.equal(SLOT.has(o, 'foo'), true, 'existent slot yields true'); + + t.end(); +}); + +test('get', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.get(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.get({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + var o = {}; + t.equal(SLOT.get(o, 'nonexistent'), undefined, 'nonexistent slot is undefined'); + + var v = {}; + SLOT.set(o, 'f', v); + t.equal(SLOT.get(o, 'f'), v, '"get" retrieves value set by "set"'); + + t.end(); +}); + +test('set', function (t) { + forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) { + t['throws']( + function () { SLOT.set(primitive, ''); }, + TypeError, + inspect(primitive) + ' is not an Object' + ); + }); + + forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) { + t['throws']( + function () { SLOT.set({}, nonString); }, + TypeError, + inspect(nonString) + ' is not a String' + ); + }); + + var o = function () {}; + t.equal(SLOT.get(o, 'f'), undefined, 'slot not set'); + + SLOT.set(o, 'f', 42); + t.equal(SLOT.get(o, 'f'), 42, 'slot was set'); + + SLOT.set(o, 'f', Infinity); + t.equal(SLOT.get(o, 'f'), Infinity, 'slot was set again'); + + t.end(); +}); diff --git a/docs/snippets/node_modules/ipaddr.js/package.json b/docs/snippets/node_modules/ipaddr.js/package.json index b42d6ba5..9c4b09ce 100644 --- a/docs/snippets/node_modules/ipaddr.js/package.json +++ b/docs/snippets/node_modules/ipaddr.js/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "_shasum": "bff38543eeb8984825079ff3a2a8e6cbd46781b3", "_spec": "ipaddr.js@1.9.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/proxy-addr", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/proxy-addr", "author": { "name": "whitequark", "email": "whitequark@whitequark.org" diff --git a/docs/snippets/node_modules/is-arguments/.nycrc b/docs/snippets/node_modules/is-arguments/.nycrc index 1826526e..bdd626ce 100644 --- a/docs/snippets/node_modules/is-arguments/.nycrc +++ b/docs/snippets/node_modules/is-arguments/.nycrc @@ -2,10 +2,6 @@ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], - "lines": 86, - "statements": 85.93, - "functions": 82.43, - "branches": 76.06, "exclude": [ "coverage", "test" diff --git a/docs/snippets/node_modules/is-arguments/CHANGELOG.md b/docs/snippets/node_modules/is-arguments/CHANGELOG.md index 943fe35a..a1ddafe3 100644 --- a/docs/snippets/node_modules/is-arguments/CHANGELOG.md +++ b/docs/snippets/node_modules/is-arguments/CHANGELOG.md @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.1.1](https://github.com/inspect-js/is-arguments/compare/v1.1.0...v1.1.1) - 2021-08-05 + +### Commits + +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`dd28b30`](https://github.com/inspect-js/is-arguments/commit/dd28b30f4237fac722f2ce05b0c1d7e63c4a81e4) +- [meta] do not publish github action workflow files [`87e489c`](https://github.com/inspect-js/is-arguments/commit/87e489cc77b709b96e73aaf9f9b2cd6da48f4960) +- [readme] fix repo URLs [`e2c2c6e`](https://github.com/inspect-js/is-arguments/commit/e2c2c6ee34ca21be4b19d282d96dd7ab75b63ae3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`b9ae62b`](https://github.com/inspect-js/is-arguments/commit/b9ae62b3a08a5fe84519865192e6287d5b6966f7) +- [readme] add github actions/codecov badges [`504c0a5`](https://github.com/inspect-js/is-arguments/commit/504c0a508dc313eae5942b1e35b2d031948de143) +- [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams [`dc29e52`](https://github.com/inspect-js/is-arguments/commit/dc29e521d71da420414110919a1e0fde8ec6eba3) +- [Dev Deps] update `auto-changelog`, `eslint`, `tape` [`a966d25`](https://github.com/inspect-js/is-arguments/commit/a966d25535c5f050ca5ce43a1559f93698a7130b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`1218944`](https://github.com/inspect-js/is-arguments/commit/12189445a195558fdccebe099c699272d2082aa8) +- [meta] use `prepublishOnly` script for npm 7+ [`757dbee`](https://github.com/inspect-js/is-arguments/commit/757dbee3ec6f6225d4c7c91582e045cc1183dbd8) +- [Deps] update `call-bind` [`b206f05`](https://github.com/inspect-js/is-arguments/commit/b206f059571c430375c632e40dd29249fa76a8fd) +- [actions] update workflows [`b89b2f1`](https://github.com/inspect-js/is-arguments/commit/b89b2f1ab98bedebdf97d2397246030a1132c84e) + ## [v1.1.0](https://github.com/inspect-js/is-arguments/compare/v1.0.4...v1.1.0) - 2020-12-04 ### Commits diff --git a/docs/snippets/node_modules/is-arguments/index.js b/docs/snippets/node_modules/is-arguments/index.js index 805f977e..e17e906c 100644 --- a/docs/snippets/node_modules/is-arguments/index.js +++ b/docs/snippets/node_modules/is-arguments/index.js @@ -1,6 +1,6 @@ 'use strict'; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var hasToStringTag = require('has-tostringtag/shams')(); var callBound = require('call-bind/callBound'); var $toString = callBound('Object.prototype.toString'); diff --git a/docs/snippets/node_modules/is-arguments/package.json b/docs/snippets/node_modules/is-arguments/package.json index 7ae2da93..c0038278 100644 --- a/docs/snippets/node_modules/is-arguments/package.json +++ b/docs/snippets/node_modules/is-arguments/package.json @@ -1,8 +1,8 @@ { "_from": "is-arguments@^1.0.4", - "_id": "is-arguments@1.1.0", + "_id": "is-arguments@1.1.1", "_inBundle": false, - "_integrity": "sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg==", + "_integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "_location": "/is-arguments", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/util" ], - "_resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.0.tgz", - "_shasum": "62353031dfbee07ceb34656a6bde59efecae8dd9", + "_resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "_shasum": "15b3f88fda01f2a97fec84ca761a560f123efa9b", "_spec": "is-arguments@^1.0.4", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/util", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/util", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", @@ -47,18 +47,19 @@ } ], "dependencies": { - "call-bind": "^1.0.0" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "deprecated": false, "description": "Is this an arguments object? It's a harder question than you think.", "devDependencies": { - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", - "auto-changelog": "^2.2.1", - "eslint": "^7.14.0", + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "auto-changelog": "^2.3.0", + "eslint": "^7.32.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.0.1" + "tape": "^5.3.0" }, "engines": { "node": ">= 0.4" @@ -86,7 +87,8 @@ "lint": "eslint .", "posttest": "npx aud --production", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", - "prepublish": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", "pretest": "npm run --silent lint", "test": "npm run tests-only", "tests-only": "nyc tape 'test/**/*.js'", @@ -110,5 +112,5 @@ "android-browser/4.2" ] }, - "version": "1.1.0" + "version": "1.1.1" } diff --git a/docs/snippets/node_modules/is-arguments/test/index.js b/docs/snippets/node_modules/is-arguments/test/index.js index 818b7b02..6d7cd5ac 100644 --- a/docs/snippets/node_modules/is-arguments/test/index.js +++ b/docs/snippets/node_modules/is-arguments/test/index.js @@ -2,7 +2,7 @@ var test = require('tape'); var isArguments = require('../'); -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var hasToStringTag = require('has-tostringtag/shams')(); test('primitives', function (t) { t.notOk(isArguments([]), 'array is not arguments'); diff --git a/docs/snippets/node_modules/is-bigint/.eslintrc b/docs/snippets/node_modules/is-bigint/.eslintrc index c8872383..1283fcf6 100644 --- a/docs/snippets/node_modules/is-bigint/.eslintrc +++ b/docs/snippets/node_modules/is-bigint/.eslintrc @@ -3,10 +3,6 @@ "extends": "@ljharb", - "globals": { - "BigInt": true, - }, - "rules": { "new-cap": [2, { "capIsNewExceptions": ["BigInt"] }], "operator-linebreak": [2, "before"], diff --git a/docs/snippets/node_modules/is-bigint/CHANGELOG.md b/docs/snippets/node_modules/is-bigint/CHANGELOG.md index b62ddcf1..c1b0271e 100644 --- a/docs/snippets/node_modules/is-bigint/CHANGELOG.md +++ b/docs/snippets/node_modules/is-bigint/CHANGELOG.md @@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.0.4](https://github.com/inspect-js/is-bigint/compare/v1.0.3...v1.0.4) - 2021-08-11 + +### Commits + +- [eslint] remove unnecessary eslintrc file [`7220aa5`](https://github.com/inspect-js/is-bigint/commit/7220aa515c51649b48ba57bb77f92d85e27557d8) +- [readme] add github actions/codecov badges [`053a071`](https://github.com/inspect-js/is-bigint/commit/053a07123511eef5a91fd7889ae2d8323fbcf7d7) +- [Deps] add `has-bigints` as a runtime dependency [`0fc3c9d`](https://github.com/inspect-js/is-bigint/commit/0fc3c9d5165f62500ea9c27943cb302df65432f7) +- [Dev Deps] update `tape` [`145f11d`](https://github.com/inspect-js/is-bigint/commit/145f11d1d285d92b3144f48178fe0fb3b2f828d9) + +## [v1.0.3](https://github.com/inspect-js/is-bigint/compare/v1.0.2...v1.0.3) - 2021-08-06 + +### Commits + +- [Tests] use `has-tostringtag` for easier checking of Symbol.toStringTag [`3b44080`](https://github.com/inspect-js/is-bigint/commit/3b440801b69689d907b33184134f00d7e8a35f9f) +- [Dev Deps] update `auto-changelog`, `eslint`, `object-inspect`, `tape` [`e4d4a6c`](https://github.com/inspect-js/is-bigint/commit/e4d4a6c2ab743b52eda906abd1ed4b0608952533) +- [Fix] use `has-bigints` for more robust BigInt detection [`7bb9d7a`](https://github.com/inspect-js/is-bigint/commit/7bb9d7ab42214c12ce25e9f0cfe2af769388c3bb) + ## [v1.0.2](https://github.com/inspect-js/is-bigint/compare/v1.0.1...v1.0.2) - 2021-05-04 ### Commits diff --git a/docs/snippets/node_modules/is-bigint/index.js b/docs/snippets/node_modules/is-bigint/index.js index 6ce59c8a..8da47d74 100644 --- a/docs/snippets/node_modules/is-bigint/index.js +++ b/docs/snippets/node_modules/is-bigint/index.js @@ -1,6 +1,8 @@ 'use strict'; -if (typeof BigInt === 'function') { +var hasBigInts = require('has-bigints')(); + +if (hasBigInts) { var bigIntValueOf = BigInt.prototype.valueOf; var tryBigInt = function tryBigIntObject(value) { try { diff --git a/docs/snippets/node_modules/is-bigint/package.json b/docs/snippets/node_modules/is-bigint/package.json index 6954e481..bbfa8ac4 100644 --- a/docs/snippets/node_modules/is-bigint/package.json +++ b/docs/snippets/node_modules/is-bigint/package.json @@ -1,8 +1,8 @@ { "_from": "is-bigint@^1.0.1", - "_id": "is-bigint@1.0.2", + "_id": "is-bigint@1.0.4", "_inBundle": false, - "_integrity": "sha512-0JV5+SOCQkIdzjBK9buARcV804Ddu7A0Qet6sHi3FimE9ne6m4BGQZfRn+NZiXbBk4F4XmHfDZIipLj9pX8dSA==", + "_integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", "_location": "/is-bigint", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/which-boxed-primitive" ], - "_resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.2.tgz", - "_shasum": "ffb381442503235ad245ea89e45b3dbff040ee5a", + "_resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "_shasum": "08147a1875bc2b32005d41ccd8291dffc6691df3", "_spec": "is-bigint@^1.0.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/which-boxed-primitive", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/which-boxed-primitive", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" @@ -38,18 +38,21 @@ "url": "https://github.com/inspect-js/is-bigint/issues" }, "bundleDependencies": false, + "dependencies": { + "has-bigints": "^1.0.1" + }, "deprecated": false, "description": "Is this value an ES BigInt?", "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "eslint": "^7.25.0", + "auto-changelog": "^2.3.0", + "eslint": "^7.32.0", "has-symbols": "^1.0.2", "nyc": "^10.3.2", - "object-inspect": "^1.10.2", + "object-inspect": "^1.11.0", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -79,5 +82,5 @@ "tests-only": "nyc tape 'test/**/*.js'", "version": "auto-changelog && git add CHANGELOG.md" }, - "version": "1.0.2" + "version": "1.0.4" } diff --git a/docs/snippets/node_modules/is-bigint/test/.eslintrc b/docs/snippets/node_modules/is-bigint/test/.eslintrc deleted file mode 100644 index 1ac0d47b..00000000 --- a/docs/snippets/node_modules/is-bigint/test/.eslintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "rules": { - "max-statements-per-line": [2, { "max": 2 }], - "no-restricted-properties": 0, - "symbol-description": 0, - } -} diff --git a/docs/snippets/node_modules/is-bigint/test/index.js b/docs/snippets/node_modules/is-bigint/test/index.js index 069f73d7..21537d6a 100644 --- a/docs/snippets/node_modules/is-bigint/test/index.js +++ b/docs/snippets/node_modules/is-bigint/test/index.js @@ -2,7 +2,11 @@ var test = require('tape'); var inspect = require('object-inspect'); -var isBigInt = require('..'); +var hasBigInts = require('has-bigints')(); +var hasSymbols = require('has-symbols')(); +var hasToStringTag = require('has-tostringtag/shams')(); + +var isBigInt = require('../'); var debug = function (v, m) { return inspect(v) + ' ' + m; }; @@ -13,9 +17,6 @@ var forEach = function (arr, func) { } }; -var hasSymbols = require('has-symbols')(); -var hasBigInts = typeof BigInt === 'function'; - test('non-BigInt values', function (t) { var nonBigInts = [ true, @@ -50,7 +51,7 @@ test('faked BigInt values', function (t) { st.end(); }); - t.test('faked @@toStringTag', { skip: !hasBigInts || !hasSymbols || !Symbol.toStringTag }, function (st) { + t.test('faked @@toStringTag', { skip: !hasBigInts || !hasToStringTag }, function (st) { var fakeBigInt = { valueOf: function () { return BigInt(42); } }; fakeBigInt[Symbol.toStringTag] = 'BigInt'; st.equal(false, isBigInt(fakeBigInt), 'object with fake BigInt @@toStringTag and valueOf returning a BigInt is not a BigInt'); diff --git a/docs/snippets/node_modules/is-boolean-object/CHANGELOG.md b/docs/snippets/node_modules/is-boolean-object/CHANGELOG.md index 25a891ad..f789bdb0 100644 --- a/docs/snippets/node_modules/is-boolean-object/CHANGELOG.md +++ b/docs/snippets/node_modules/is-boolean-object/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.1.2](https://github.com/inspect-js/is-boolean-object/compare/v1.1.1...v1.1.2) - 2021-08-05 + +### Commits + +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`6d319ea`](https://github.com/inspect-js/is-boolean-object/commit/6d319eac0ba237f7ba440a1fc4b32d007b1b0cf3) +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4f85bef`](https://github.com/inspect-js/is-boolean-object/commit/4f85bef244f8fdd9ab99db0afe0b8fa00c853709) + ## [v1.1.1](https://github.com/inspect-js/is-boolean-object/compare/v1.1.0...v1.1.1) - 2021-05-07 ### Commits diff --git a/docs/snippets/node_modules/is-boolean-object/index.js b/docs/snippets/node_modules/is-boolean-object/index.js index 0cd8e777..e1011f6c 100644 --- a/docs/snippets/node_modules/is-boolean-object/index.js +++ b/docs/snippets/node_modules/is-boolean-object/index.js @@ -13,7 +13,7 @@ var tryBooleanObject = function booleanBrandCheck(value) { } }; var boolClass = '[object Boolean]'; -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; +var hasToStringTag = require('has-tostringtag/shams')(); module.exports = function isBoolean(value) { if (typeof value === 'boolean') { diff --git a/docs/snippets/node_modules/is-boolean-object/package.json b/docs/snippets/node_modules/is-boolean-object/package.json index 9765794b..287fa8cc 100644 --- a/docs/snippets/node_modules/is-boolean-object/package.json +++ b/docs/snippets/node_modules/is-boolean-object/package.json @@ -1,8 +1,8 @@ { "_from": "is-boolean-object@^1.1.0", - "_id": "is-boolean-object@1.1.1", + "_id": "is-boolean-object@1.1.2", "_inBundle": false, - "_integrity": "sha512-bXdQWkECBUIAcCkeH1unwJLIpZYaa5VvuygSyS/c2lf719mTKZDU5UdDRlpd01UjADgmW8RfqaP+mRaVPdr/Ng==", + "_integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", "_location": "/is-boolean-object", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/which-boxed-primitive" ], - "_resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.1.tgz", - "_shasum": "3c0878f035cb821228d350d2e1e36719716a3de8", + "_resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "_shasum": "5c6dc200246dd9321ae4b885a114bb1f75f63719", "_spec": "is-boolean-object@^1.1.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/which-boxed-primitive", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/which-boxed-primitive", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" @@ -39,23 +39,24 @@ }, "bundleDependencies": false, "dependencies": { - "call-bind": "^1.0.2" + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" }, "deprecated": false, "description": "Is this value a JS Boolean? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "core-js": "^3.12.0", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", "eclint": "^2.8.1", - "eslint": "^7.25.0", + "eslint": "^7.32.0", "foreach": "^2.0.5", "indexof": "^0.0.1", "is": "^3.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.0" }, "engines": { "node": ">= 0.4" @@ -114,5 +115,5 @@ "android-browser/4.2" ] }, - "version": "1.1.1" + "version": "1.1.2" } diff --git a/docs/snippets/node_modules/is-boolean-object/test/index.js b/docs/snippets/node_modules/is-boolean-object/test/index.js index 9ca4b34e..cd4c44fe 100644 --- a/docs/snippets/node_modules/is-boolean-object/test/index.js +++ b/docs/snippets/node_modules/is-boolean-object/test/index.js @@ -2,7 +2,7 @@ var test = require('tape'); var isBoolean = require('../'); -var hasSymbols = require('has-symbols/shams')(); +var hasToStringTag = require('has-tostringtag/shams')(); test('not Booleans', function (t) { t.test('primitives', function (st) { @@ -29,7 +29,7 @@ test('not Booleans', function (t) { t.end(); }); -test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { var fakeBoolean = { toString: function () { return 'true'; }, valueOf: function () { return true; } diff --git a/docs/snippets/node_modules/is-callable/.editorconfig b/docs/snippets/node_modules/is-callable/.editorconfig index 46236311..87f2333d 100644 --- a/docs/snippets/node_modules/is-callable/.editorconfig +++ b/docs/snippets/node_modules/is-callable/.editorconfig @@ -19,3 +19,8 @@ max_line_length = off [Makefile] max_line_length = off + +[coverage*/**/*] +indent_style = off +indent_size = off +max_line_length = off diff --git a/docs/snippets/node_modules/is-callable/.github/main.workflow b/docs/snippets/node_modules/is-callable/.github/main.workflow deleted file mode 100644 index 04944811..00000000 --- a/docs/snippets/node_modules/is-callable/.github/main.workflow +++ /dev/null @@ -1,14 +0,0 @@ -workflow "Autorebase branch on merge commits" { - on = "push" - resolves = ["rebase"] -} - -workflow "Autorebase PR on merge commits" { - on = "pull_request" - resolves = ["rebase"] -} - - action "rebase" { - uses = "ljharb/rebase@latest" - secrets = ["GITHUB_TOKEN"] -} diff --git a/docs/snippets/node_modules/is-callable/.nycrc b/docs/snippets/node_modules/is-callable/.nycrc index 1826526e..bdd626ce 100644 --- a/docs/snippets/node_modules/is-callable/.nycrc +++ b/docs/snippets/node_modules/is-callable/.nycrc @@ -2,10 +2,6 @@ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], - "lines": 86, - "statements": 85.93, - "functions": 82.43, - "branches": 76.06, "exclude": [ "coverage", "test" diff --git a/docs/snippets/node_modules/is-callable/CHANGELOG.md b/docs/snippets/node_modules/is-callable/CHANGELOG.md index 6b88f5b7..0427308e 100644 --- a/docs/snippets/node_modules/is-callable/CHANGELOG.md +++ b/docs/snippets/node_modules/is-callable/CHANGELOG.md @@ -1,3 +1,17 @@ +1.2.4 / 2021-08-05 +================= + * [Fix] use `has-tostringtag` approach to behave correctly in the presence of symbol shams + * [readme] fix repo URLs + * [readme] add actions and codecov badges + * [readme] remove defunct badges + * [meta] ignore eclint checking coverage output + * [meta] use `prepublishOnly` script for npm 7+ + * [actions] use `node/install` instead of `node/run`; use `codecov` action + * [actions] remove unused workflow file + * [Tests] run `nyc` on all tests; use `tape` runner + * [Tests] use `available-typed-arrays`, `for-each`, `has-symbols`, `object-inspect` + * [Dev Deps] update `available-typed-arrays`, `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` + 1.2.3 / 2021-01-31 ================= * [Fix] `document.all` is callable (do not use `document.all`!) diff --git a/docs/snippets/node_modules/is-callable/index.js b/docs/snippets/node_modules/is-callable/index.js index f36d71db..86c9771c 100644 --- a/docs/snippets/node_modules/is-callable/index.js +++ b/docs/snippets/node_modules/is-callable/index.js @@ -45,7 +45,7 @@ var tryFunctionObject = function tryFunctionToStr(value) { var toStr = Object.prototype.toString; var fnClass = '[object Function]'; var genClass = '[object GeneratorFunction]'; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag` /* globals document: false */ var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {}; diff --git a/docs/snippets/node_modules/is-callable/package.json b/docs/snippets/node_modules/is-callable/package.json index 02a29254..f853a2a8 100644 --- a/docs/snippets/node_modules/is-callable/package.json +++ b/docs/snippets/node_modules/is-callable/package.json @@ -1,35 +1,35 @@ { - "_from": "is-callable@^1.2.3", - "_id": "is-callable@1.2.3", + "_from": "is-callable@^1.2.4", + "_id": "is-callable@1.2.4", "_inBundle": false, - "_integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "_integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", "_location": "/is-callable", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "is-callable@^1.2.3", + "raw": "is-callable@^1.2.4", "name": "is-callable", "escapedName": "is-callable", - "rawSpec": "^1.2.3", + "rawSpec": "^1.2.4", "saveSpec": null, - "fetchSpec": "^1.2.3" + "fetchSpec": "^1.2.4" }, "_requiredBy": [ "/es-abstract", "/es-to-primitive" ], - "_resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", - "_shasum": "8b1e0500b73a1d76c70487636f368e519de8db8e", - "_spec": "is-callable@^1.2.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/es-abstract", + "_resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "_shasum": "47301d58dd0259407865547853df6d61fe471945", + "_spec": "is-callable@^1.2.4", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", "url": "http://ljharb.codes" }, "bugs": { - "url": "https://github.com/ljharb/is-callable/issues" + "url": "https://github.com/inspect-js/is-callable/issues" }, "bundleDependencies": false, "contributors": [ @@ -39,24 +39,25 @@ "url": "http://ljharb.codes" } ], - "dependencies": {}, "deprecated": false, "description": "Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.", "devDependencies": { - "@ljharb/eslint-config": "^17.5.0", - "aud": "^1.1.3", - "covert": "^1.1.1", + "@ljharb/eslint-config": "^17.6.0", + "aud": "^1.1.5", + "available-typed-arrays": "^1.0.4", "eclint": "^2.8.1", - "eslint": "^7.19.0", - "foreach": "^2.0.5", - "istanbul": "1.1.0-alpha.1", - "istanbul-merge": "^1.1.1", + "es-value-fixtures": "^1.2.1", + "eslint": "^7.32.0", + "for-each": "^0.3.3", + "has-tostringtag": "^1.0.0", "make-arrow-function": "^1.2.0", "make-async-function": "^1.0.0", "make-generator-function": "^2.0.0", + "nyc": "^10.3.2", + "object-inspect": "^1.11.0", "rimraf": "^2.7.1", "safe-publish-latest": "^1.1.4", - "tape": "^5.1.1" + "tape": "^5.3.0" }, "engines": { "node": ">= 0.4" @@ -69,7 +70,7 @@ "rimraf" ] }, - "homepage": "https://github.com/ljharb/is-callable#readme", + "homepage": "https://github.com/inspect-js/is-callable#readme", "keywords": [ "Function", "function", @@ -87,26 +88,17 @@ "name": "is-callable", "repository": { "type": "git", - "url": "git://github.com/ljharb/is-callable.git" + "url": "git://github.com/inspect-js/is-callable.git" }, "scripts": { - "coverage": "npm run --silent istanbul", - "covert": "covert test", - "covert:quiet": "covert test --quiet", - "istanbul": "npm run --silent istanbul:clean && npm run --silent istanbul:std && npm run --silent istanbul:harmony && npm run --silent istanbul:merge && istanbul check", - "istanbul:clean": "rimraf coverage coverage-std coverage-harmony", - "istanbul:harmony": "node --harmony ./node_modules/istanbul/lib/cli.js cover test --dir coverage-harmony", - "istanbul:merge": "istanbul-merge --out coverage/coverage.raw.json coverage-harmony/coverage.raw.json coverage-std/coverage.raw.json && istanbul report html", - "istanbul:std": "istanbul cover test --report html --dir coverage-std", "lint": "eslint .", - "posttest": "npx aud --production", + "posttest": "aud --production", "prelint": "eclint check *", - "prepublish": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", "pretest": "npm run --silent lint", - "test": "npm run --silent tests-only", - "test:staging": "node --es-staging test", - "test:stock": "node test", - "tests-only": "npm run --silent test:stock && npm run --silent test:staging" + "test": "npm run tests-only --", + "tests-only": "nyc tape 'test/**/*.js'" }, "testling": { "files": "test/index.js", @@ -126,5 +118,5 @@ "android-browser/4.2" ] }, - "version": "1.2.3" + "version": "1.2.4" } diff --git a/docs/snippets/node_modules/is-callable/test/index.js b/docs/snippets/node_modules/is-callable/test/index.js index 2eacb0ee..a3c348c2 100644 --- a/docs/snippets/node_modules/is-callable/test/index.js +++ b/docs/snippets/node_modules/is-callable/test/index.js @@ -5,7 +5,11 @@ var test = require('tape'); var isCallable = require('../'); -var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; +var hasToStringTag = require('has-tostringtag/shams')(); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var typedArrayNames = require('available-typed-arrays')(); var generators = require('make-generator-function')(); var arrows = require('make-arrow-function').list(); var asyncs = require('make-async-function').list(); @@ -15,7 +19,6 @@ try { weirdlyCommentedArrowFn = Function('return cl/*/**/=>/**/ass - 1;')(); /* eslint-enable no-new-func */ } catch (e) { /**/ } -var forEach = require('foreach'); var noop = function () {}; var classFake = function classFake() { }; // eslint-disable-line func-name-matching @@ -63,46 +66,32 @@ var classAnonymous = invokeFunction('"use strict"; return class{}'); var classAnonymousCommentedOneLine = invokeFunction('"use strict"; return class/*/*/{}'); test('not callables', function (t) { - t.test('non-number/string primitives', function (st) { - st.notOk(isCallable(), 'undefined is not callable'); - st.notOk(isCallable(null), 'null is not callable'); - st.notOk(isCallable(false), 'false is not callable'); - st.notOk(isCallable(true), 'true is not callable'); - st.end(); - }); - - t.notOk(isCallable([]), 'array is not callable'); - t.notOk(isCallable({}), 'object is not callable'); - t.notOk(isCallable(/a/g), 'regex literal is not callable'); - t.notOk(isCallable(new RegExp('a', 'g')), 'regex object is not callable'); - t.notOk(isCallable(new Date()), 'new Date() is not callable'); - - t.test('numbers', function (st) { - st.notOk(isCallable(42), 'number is not callable'); - st.notOk(isCallable(Object(42)), 'number object is not callable'); - st.notOk(isCallable(NaN), 'NaN is not callable'); - st.notOk(isCallable(Infinity), 'Infinity is not callable'); - st.end(); - }); - - t.test('strings', function (st) { - st.notOk(isCallable('foo'), 'string primitive is not callable'); - st.notOk(isCallable(Object('foo')), 'string object is not callable'); - st.end(); + t.notOk(isCallable(), 'implicit undefined is not callable'); + + forEach(v.nonFunctions.concat([ + Object(42), + Object('foo'), + NaN, + [], + /a/g, + new RegExp('a', 'g'), + new Date() + ]), function (nonFunction) { + t.equal(isCallable(nonFunction), false, inspect(nonFunction) + ' is not callable'); }); t.test('non-function with function in its [[Prototype]] chain', function (st) { var Foo = function Bar() {}; Foo.prototype = noop; - st.equal(true, isCallable(Foo), 'sanity check: Foo is callable'); - st.equal(false, isCallable(new Foo()), 'instance of Foo is not callable'); + st.equal(isCallable(Foo), true, 'sanity check: Foo is callable'); + st.equal(isCallable(new Foo()), false, 'instance of Foo is not callable'); st.end(); }); t.end(); }); -test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { var fakeFunction = { toString: function () { return String(return3); }, valueOf: return3 @@ -114,18 +103,6 @@ test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) t.end(); }); -var typedArrayNames = [ - 'Int8Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Int16Array', - 'Uint16Array', - 'Int32Array', - 'Uint32Array', - 'Float32Array', - 'Float64Array' -]; - test('Functions', function (t) { t.ok(isCallable(noop), 'function is callable'); t.ok(isCallable(classFake), 'function with name containing "class" is callable'); @@ -134,14 +111,9 @@ test('Functions', function (t) { t.end(); }); -test('Typed Arrays', function (st) { +test('Typed Arrays', { skip: typedArrayNames.length === 0 }, function (st) { forEach(typedArrayNames, function (typedArray) { - /* istanbul ignore if : covered in node 0.6 */ - if (typeof global[typedArray] === 'undefined') { - st.comment('# SKIP typed array "' + typedArray + '" not supported'); - } else { - st.ok(isCallable(global[typedArray]), typedArray + ' is callable'); - } + st.ok(isCallable(global[typedArray]), typedArray + ' is callable'); }); st.end(); }); diff --git a/docs/snippets/node_modules/is-date-object/.jscs.json b/docs/snippets/node_modules/is-date-object/.jscs.json deleted file mode 100644 index b4d9b8b4..00000000 --- a/docs/snippets/node_modules/is-date-object/.jscs.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "es3": true, - - "additionalRules": [], - - "requireSemicolons": true, - - "disallowMultipleSpaces": true, - - "disallowIdentifierNames": [], - - "requireCurlyBraces": { - "allExcept": [], - "keywords": ["if", "else", "for", "while", "do", "try", "catch"] - }, - - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], - - "disallowSpaceAfterKeywords": [], - - "disallowSpaceBeforeComma": true, - "disallowSpaceAfterComma": false, - "disallowSpaceBeforeSemicolon": true, - - "disallowNodeTypes": [ - "DebuggerStatement", - "ForInStatement", - "LabeledStatement", - "SwitchCase", - "SwitchStatement", - "WithStatement" - ], - - "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "requireSpaceBetweenArguments": true, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "requireSpaceAfterPrefixUnaryOperators": [], - - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforePostfixUnaryOperators": [], - - "disallowSpaceBeforeBinaryOperators": [], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "disallowSpaceAfterBinaryOperators": [], - - "disallowImplicitTypeConversion": ["binary", "string"], - - "disallowKeywords": ["with", "eval"], - - "requireKeywordsOnNewLine": [], - "disallowKeywordsOnNewLine": ["else"], - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "disallowTrailingComma": true, - - "excludeFiles": ["node_modules/**", "vendor/**"], - - "disallowMultipleLineStrings": true, - - "requireDotNotation": { "allExcept": ["keywords"] }, - - "requireParenthesesAroundIIFE": true, - - "validateLineBreaks": "LF", - - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - - "disallowOperatorBeforeLineBreak": [], - - "requireSpaceBeforeKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "finally", - "while", - "with", - "return" - ], - - "validateAlignedFunctionParameters": { - "lineBreakAfterOpeningBraces": true, - "lineBreakBeforeClosingBraces": true - }, - - "requirePaddingNewLinesBeforeExport": true, - - "validateNewlineAfterArrayElements": { - "maximum": 1 - }, - - "requirePaddingNewLinesAfterUseStrict": true, - - "disallowArrowFunctions": true, - - "disallowMultiLineTernary": true, - - "validateOrderInObjectKeys": "asc-insensitive", - - "disallowIdenticalDestructuringNames": true, - - "disallowNestedTernaries": { "maxLevel": 1 }, - - "requireSpaceAfterComma": { "allExcept": ["trailing"] }, - "requireAlignedMultilineParams": false, - - "requireSpacesInGenerator": { - "afterStar": true - }, - - "disallowSpacesInGenerator": { - "beforeStar": true - }, - - "disallowVar": false, - - "requireArrayDestructuring": false, - - "requireEnhancedObjectLiterals": false, - - "requireObjectDestructuring": false, - - "requireEarlyReturn": false, - - "requireCapitalizedConstructorsNew": { - "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] - }, - - "requireImportAlphabetized": false, - - "requireSpaceBeforeObjectValues": true, - "requireSpaceBeforeDestructuredValues": true, - - "disallowSpacesInsideTemplateStringPlaceholders": true, - - "disallowArrayDestructuringReturn": false, - - "requireNewlineBeforeSingleStatementsInIf": false, - - "disallowUnusedVariables": true, - - "requireSpacesInsideImportedObjectBraces": true, - - "requireUseStrict": true -} - diff --git a/docs/snippets/node_modules/is-date-object/CHANGELOG.md b/docs/snippets/node_modules/is-date-object/CHANGELOG.md index 0f4fbbd9..49f624a4 100644 --- a/docs/snippets/node_modules/is-date-object/CHANGELOG.md +++ b/docs/snippets/node_modules/is-date-object/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.0.5](https://github.com/inspect-js/is-date-object/compare/v1.0.4...v1.0.5) - 2021-08-05 + +### Commits + +- [meta] remove `.jscs.json` [`31c731c`](https://github.com/inspect-js/is-date-object/commit/31c731c5efc5b1b86e6426d904373dc6225b929f) +- [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams [`17a6df4`](https://github.com/inspect-js/is-date-object/commit/17a6df4a3ab9bcb1395a638ced14f571f9549427) +- [Dev Deps] update `eslint`, `auto-changelog`, `tape` [`79db3af`](https://github.com/inspect-js/is-date-object/commit/79db3af1a745042a0a11e03c7dd7db910b5e0d01) + ## [v1.0.4](https://github.com/inspect-js/is-date-object/compare/v1.0.3...v1.0.4) - 2021-05-07 ### Commits diff --git a/docs/snippets/node_modules/is-date-object/index.js b/docs/snippets/node_modules/is-date-object/index.js index 996c5bb1..11628f3b 100644 --- a/docs/snippets/node_modules/is-date-object/index.js +++ b/docs/snippets/node_modules/is-date-object/index.js @@ -12,7 +12,7 @@ var tryDateObject = function tryDateGetDayCall(value) { var toStr = Object.prototype.toString; var dateClass = '[object Date]'; -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; +var hasToStringTag = require('has-tostringtag/shams')(); module.exports = function isDateObject(value) { if (typeof value !== 'object' || value === null) { diff --git a/docs/snippets/node_modules/is-date-object/package.json b/docs/snippets/node_modules/is-date-object/package.json index 7433c031..5148203a 100644 --- a/docs/snippets/node_modules/is-date-object/package.json +++ b/docs/snippets/node_modules/is-date-object/package.json @@ -1,8 +1,8 @@ { "_from": "is-date-object@^1.0.1", - "_id": "is-date-object@1.0.4", + "_id": "is-date-object@1.0.5", "_inBundle": false, - "_integrity": "sha512-/b4ZVsG7Z5XVtIxs/h9W8nvfLgSAyKYdtGWQLbqy6jA1icmgjf8WCoTKgeS4wy5tYaPePouzFMANbnj94c2Z+A==", + "_integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "_location": "/is-date-object", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/es-to-primitive" ], - "_resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.4.tgz", - "_shasum": "550cfcc03afada05eea3dd30981c7b09551f73e5", + "_resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "_shasum": "0841d5536e724c25597bf6ea62e1bd38298df31f", "_spec": "is-date-object@^1.0.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/es-to-primitive", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-to-primitive", "author": { "name": "Jordan Harband" }, @@ -37,20 +37,23 @@ "url": "https://github.com/inspect-js/is-date-object/issues" }, "bundleDependencies": false, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "deprecated": false, "description": "Is this value a JS Date object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", + "auto-changelog": "^2.3.0", "core-js": "^3.12.0", - "eslint": "^7.26.0", + "eslint": "^7.32.0", "foreach": "^2.0.5", "indexof": "^0.0.1", "is": "^3.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.0" }, "engines": { "node": ">= 0.4" @@ -103,5 +106,5 @@ "android-browser/4.2" ] }, - "version": "1.0.4" + "version": "1.0.5" } diff --git a/docs/snippets/node_modules/is-date-object/test/index.js b/docs/snippets/node_modules/is-date-object/test/index.js index 3b2d93f5..5279dad0 100644 --- a/docs/snippets/node_modules/is-date-object/test/index.js +++ b/docs/snippets/node_modules/is-date-object/test/index.js @@ -2,7 +2,7 @@ var test = require('tape'); var isDate = require('../'); -var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator !== 'undefined'; +var hasToStringTag = require('has-tostringtag/shams')(); test('not Dates', function (t) { t.notOk(isDate(), 'undefined is not Date'); @@ -19,7 +19,7 @@ test('not Dates', function (t) { t.end(); }); -test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { var realDate = new Date(); var fakeDate = { toString: function () { return String(realDate); }, diff --git a/docs/snippets/node_modules/is-generator-function/CHANGELOG.md b/docs/snippets/node_modules/is-generator-function/CHANGELOG.md index 73b0fb18..25b705ca 100644 --- a/docs/snippets/node_modules/is-generator-function/CHANGELOG.md +++ b/docs/snippets/node_modules/is-generator-function/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.0.10](https://github.com/inspect-js/is-generator-function/compare/v1.0.9...v1.0.10) - 2021-08-05 + +### Commits + +- [Dev Deps] update `eslint`, `auto-changelog`, `core-js`, `tape` [`63cd935`](https://github.com/inspect-js/is-generator-function/commit/63cd9353eead5ad5eb8cf581fc4129841641bb43) +- [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams [`8c3fe76`](https://github.com/inspect-js/is-generator-function/commit/8c3fe76b546fbc5085381df65800e4fc67e25ede) +- [Dev Deps] unpin `core-js` v3 [`ebf2885`](https://github.com/inspect-js/is-generator-function/commit/ebf2885bc202b59f37e074f28951639873c6f38e) + ## [v1.0.9](https://github.com/inspect-js/is-generator-function/compare/v1.0.8...v1.0.9) - 2021-05-05 ### Fixed diff --git a/docs/snippets/node_modules/is-generator-function/index.js b/docs/snippets/node_modules/is-generator-function/index.js index a3873e13..9064e91f 100644 --- a/docs/snippets/node_modules/is-generator-function/index.js +++ b/docs/snippets/node_modules/is-generator-function/index.js @@ -3,7 +3,7 @@ var toStr = Object.prototype.toString; var fnToStr = Function.prototype.toString; var isFnRegex = /^\s*(?:function)?\*/; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var hasToStringTag = require('has-tostringtag/shams')(); var getProto = Object.getPrototypeOf; var getGeneratorFunc = function () { // eslint-disable-line consistent-return if (!hasToStringTag) { diff --git a/docs/snippets/node_modules/is-generator-function/package.json b/docs/snippets/node_modules/is-generator-function/package.json index fa269115..ba8eb364 100644 --- a/docs/snippets/node_modules/is-generator-function/package.json +++ b/docs/snippets/node_modules/is-generator-function/package.json @@ -1,8 +1,8 @@ { "_from": "is-generator-function@^1.0.7", - "_id": "is-generator-function@1.0.9", + "_id": "is-generator-function@1.0.10", "_inBundle": false, - "_integrity": "sha512-ZJ34p1uvIfptHCN7sFTjGibB9/oBg17sHqzDLfuwhvmN/qLVvIQXRQ8licZQ35WJ8KuEQt/etnnzQFI9C9Ue/A==", + "_integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", "_location": "/is-generator-function", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/util" ], - "_resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.9.tgz", - "_shasum": "e5f82c2323673e7fcad3d12858c83c4039f6399c", + "_resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "_shasum": "f1558baf1ac17e0deea7c0415c438351ff2b3c72", "_spec": "is-generator-function@^1.0.7", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/util", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/util", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" @@ -38,18 +38,21 @@ "url": "https://github.com/inspect-js/is-generator-function/issues" }, "bundleDependencies": false, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "deprecated": false, "description": "Determine if a function is a native generator function.", "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "core-js": "^2.6.5 || ^3 <3.9", - "eslint": "^7.25.0", + "auto-changelog": "^2.3.0", + "core-js": "^2.6.5 || ^3.16.0", + "eslint": "^7.32.0", "make-generator-function": "^2.0.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2", + "tape": "^5.3.0", "uglify-register": "^1.0.1" }, "engines": { @@ -109,5 +112,5 @@ "android-browser/4.2" ] }, - "version": "1.0.9" + "version": "1.0.10" } diff --git a/docs/snippets/node_modules/is-generator-function/test/index.js b/docs/snippets/node_modules/is-generator-function/test/index.js index a7fab258..cbaab5da 100644 --- a/docs/snippets/node_modules/is-generator-function/test/index.js +++ b/docs/snippets/node_modules/is-generator-function/test/index.js @@ -5,7 +5,7 @@ var test = require('tape'); var isGeneratorFunction = require('../index'); var generatorFuncs = require('make-generator-function')(); -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var hasToStringTag = require('has-tostringtag/shams')(); var forEach = function (arr, func) { var i; diff --git a/docs/snippets/node_modules/is-nan/package.json b/docs/snippets/node_modules/is-nan/package.json index 0d9fbc2d..a740bf56 100644 --- a/docs/snippets/node_modules/is-nan/package.json +++ b/docs/snippets/node_modules/is-nan/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", "_shasum": "043a54adea31748b55b6cd4e09aadafa69bd9e1d", "_spec": "is-nan@^1.2.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/assert", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/assert", "author": { "name": "Jordan Harband" }, diff --git a/docs/snippets/node_modules/is-negative-zero/package.json b/docs/snippets/node_modules/is-negative-zero/package.json index 15ae5c29..d0bae2bc 100644 --- a/docs/snippets/node_modules/is-negative-zero/package.json +++ b/docs/snippets/node_modules/is-negative-zero/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", "_shasum": "3de746c18dda2319241a53675908d8f766f11c24", "_spec": "is-negative-zero@^2.0.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/es-abstract", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" diff --git a/docs/snippets/node_modules/is-number-object/.eslintrc b/docs/snippets/node_modules/is-number-object/.eslintrc index a6dec947..c7933f4d 100644 --- a/docs/snippets/node_modules/is-number-object/.eslintrc +++ b/docs/snippets/node_modules/is-number-object/.eslintrc @@ -6,4 +6,11 @@ "rules": { "func-name-matching": 0, }, + + "overrides": [ + { + "files": "test-core-js.js", + "extends": "@ljharb/eslint-config/tests", + }, + ], } diff --git a/docs/snippets/node_modules/is-number-object/.nycrc b/docs/snippets/node_modules/is-number-object/.nycrc index bdd626ce..a69aa2d8 100644 --- a/docs/snippets/node_modules/is-number-object/.nycrc +++ b/docs/snippets/node_modules/is-number-object/.nycrc @@ -4,6 +4,7 @@ "reporter": ["text-summary", "text", "html", "json"], "exclude": [ "coverage", - "test" + "test", + "test-corejs.js" ] } diff --git a/docs/snippets/node_modules/is-number-object/CHANGELOG.md b/docs/snippets/node_modules/is-number-object/CHANGELOG.md index d6954eb1..fc9ac453 100644 --- a/docs/snippets/node_modules/is-number-object/CHANGELOG.md +++ b/docs/snippets/node_modules/is-number-object/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.0.6](https://github.com/inspect-js/is-number-object/compare/v1.0.5...v1.0.6) - 2021-08-05 + +### Commits + +- [Tests] run tests with core-js as well [`5177312`](https://github.com/inspect-js/is-number-object/commit/51773120b18e27bfe8a3bd228ef2e21f5802f338) +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`ca2b31d`](https://github.com/inspect-js/is-number-object/commit/ca2b31d81c5d7d9b11e812dee58cd627a6d634e2) +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`50950f9`](https://github.com/inspect-js/is-number-object/commit/50950f962a4b1188c478f6034194d7eb4314c884) + ## [v1.0.5](https://github.com/inspect-js/is-number-object/compare/v1.0.4...v1.0.5) - 2021-05-07 ### Commits diff --git a/docs/snippets/node_modules/is-number-object/index.js b/docs/snippets/node_modules/is-number-object/index.js index 637a4b98..9107c31c 100644 --- a/docs/snippets/node_modules/is-number-object/index.js +++ b/docs/snippets/node_modules/is-number-object/index.js @@ -11,7 +11,7 @@ var tryNumberObject = function tryNumberObject(value) { }; var toStr = Object.prototype.toString; var numClass = '[object Number]'; -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; +var hasToStringTag = require('has-tostringtag/shams')(); module.exports = function isNumberObject(value) { if (typeof value === 'number') { diff --git a/docs/snippets/node_modules/is-number-object/package.json b/docs/snippets/node_modules/is-number-object/package.json index f2d350d1..d41e251d 100644 --- a/docs/snippets/node_modules/is-number-object/package.json +++ b/docs/snippets/node_modules/is-number-object/package.json @@ -1,8 +1,8 @@ { "_from": "is-number-object@^1.0.4", - "_id": "is-number-object@1.0.5", + "_id": "is-number-object@1.0.6", "_inBundle": false, - "_integrity": "sha512-RU0lI/n95pMoUKu9v1BZP5MBcZuNSVJkMkAG2dJqC4z2GlkGUNeH68SuHuBKBD/XFe+LHZ+f9BKkLET60Niedw==", + "_integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", "_location": "/is-number-object", "_phantomChildren": {}, "_requested": { @@ -18,10 +18,10 @@ "_requiredBy": [ "/which-boxed-primitive" ], - "_resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.5.tgz", - "_shasum": "6edfaeed7950cff19afedce9fbfca9ee6dd289eb", + "_resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "_shasum": "6a7aaf838c7f0686a50b4553f7e54a96494e89f0", "_spec": "is-number-object@^1.0.4", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/which-boxed-primitive", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/which-boxed-primitive", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" @@ -38,22 +38,24 @@ "url": "https://github.com/inspect-js/is-number-object/issues" }, "bundleDependencies": false, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "deprecated": false, "description": "Is this value a JS Number object? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "core-js": "^3.12.0", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", "eclint": "^2.8.1", - "eslint": "^7.25.0", + "eslint": "^7.32.0", "foreach": "^2.0.5", - "has-symbols": "^1.0.2", "indexof": "^0.0.1", "is": "^3.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.0" }, "engines": { "node": ">= 0.4" @@ -84,7 +86,8 @@ "prepublish": "not-in-publish || npm run prepublishOnly", "prepublishOnly": "safe-publish-latest", "pretest": "npm run lint", - "test": "npm run tests-only", + "test": "npm run tests-only && npm run test:corejs", + "test:corejs": "nyc tape test-corejs.js", "tests-only": "nyc tape 'test/**/*.js'", "version": "auto-changelog && git add CHANGELOG.md" }, @@ -106,5 +109,5 @@ "android-browser/4.2" ] }, - "version": "1.0.5" + "version": "1.0.6" } diff --git a/docs/snippets/node_modules/is-number-object/test/corejs.js b/docs/snippets/node_modules/is-number-object/test/corejs.js deleted file mode 100644 index 73f0c89c..00000000 --- a/docs/snippets/node_modules/is-number-object/test/corejs.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -require('core-js'); - -require('./'); diff --git a/docs/snippets/node_modules/is-number-object/test/index.js b/docs/snippets/node_modules/is-number-object/test/index.js index 04ada7dd..bca48b28 100644 --- a/docs/snippets/node_modules/is-number-object/test/index.js +++ b/docs/snippets/node_modules/is-number-object/test/index.js @@ -2,7 +2,7 @@ var test = require('tape'); var isNumber = require('../'); -var hasSymbols = require('has-symbols/shams')(); +var hasToStringTag = require('has-tostringtag/shams')(); test('not Numbers', function (t) { t.notOk(isNumber(), 'undefined is not Number'); @@ -19,7 +19,7 @@ test('not Numbers', function (t) { t.end(); }); -test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { var fakeNumber = { toString: function () { return '7'; }, valueOf: function () { return 42; } diff --git a/docs/snippets/node_modules/is-regex/CHANGELOG.md b/docs/snippets/node_modules/is-regex/CHANGELOG.md index 3b2a48c0..b7496b21 100644 --- a/docs/snippets/node_modules/is-regex/CHANGELOG.md +++ b/docs/snippets/node_modules/is-regex/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.1.4](https://github.com/inspect-js/is-regex/compare/v1.1.3...v1.1.4) - 2021-08-05 + +### Commits + +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4b17cad`](https://github.com/inspect-js/is-regex/commit/4b17cad8496b1ae621b18335fa3afe94d0c65e83) +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`2dad4af`](https://github.com/inspect-js/is-regex/commit/2dad4afffa15f07cbbf7675b77d1f650c92652c4) + ## [v1.1.3](https://github.com/inspect-js/is-regex/compare/v1.1.2...v1.1.3) - 2021-05-07 ### Commits diff --git a/docs/snippets/node_modules/is-regex/index.js b/docs/snippets/node_modules/is-regex/index.js index 80a2d335..19780f4b 100644 --- a/docs/snippets/node_modules/is-regex/index.js +++ b/docs/snippets/node_modules/is-regex/index.js @@ -1,8 +1,7 @@ 'use strict'; var callBound = require('call-bind/callBound'); -var hasSymbols = require('has-symbols/shams')(); -var hasToStringTag = hasSymbols && !!Symbol.toStringTag; +var hasToStringTag = require('has-tostringtag/shams')(); var has; var $exec; var isRegexMarker; diff --git a/docs/snippets/node_modules/is-regex/package.json b/docs/snippets/node_modules/is-regex/package.json index 89168bcb..11bbcba1 100644 --- a/docs/snippets/node_modules/is-regex/package.json +++ b/docs/snippets/node_modules/is-regex/package.json @@ -1,27 +1,27 @@ { - "_from": "is-regex@^1.1.3", - "_id": "is-regex@1.1.3", + "_from": "is-regex@^1.1.4", + "_id": "is-regex@1.1.4", "_inBundle": false, - "_integrity": "sha512-qSVXFz28HM7y+IWX6vLCsexdlvzT1PJNFSBuaQLQ5o0IEw8UDYW6/2+eCMVyIsbM8CNLX2a/QWmSpyxYEHY7CQ==", + "_integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "_location": "/is-regex", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "is-regex@^1.1.3", + "raw": "is-regex@^1.1.4", "name": "is-regex", "escapedName": "is-regex", - "rawSpec": "^1.1.3", + "rawSpec": "^1.1.4", "saveSpec": null, - "fetchSpec": "^1.1.3" + "fetchSpec": "^1.1.4" }, "_requiredBy": [ "/es-abstract" ], - "_resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.3.tgz", - "_shasum": "d029f9aff6448b93ebbe3f33dac71511fdcbef9f", - "_spec": "is-regex@^1.1.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/es-abstract", + "_resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "_shasum": "eef5663cd59fa4c0ae339505323df6854bb15958", + "_spec": "is-regex@^1.1.4", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" @@ -40,21 +40,21 @@ "bundleDependencies": false, "dependencies": { "call-bind": "^1.0.2", - "has-symbols": "^1.0.2" + "has-tostringtag": "^1.0.0" }, "deprecated": false, "description": "Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag", "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "core-js": "^3.12.0", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", "eclint": "^2.8.1", - "eslint": "^7.26.0", + "eslint": "^7.32.0", "foreach": "^2.0.5", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.0" }, "engines": { "node": ">= 0.4" @@ -110,5 +110,5 @@ "android-browser/4.2" ] }, - "version": "1.1.3" + "version": "1.1.4" } diff --git a/docs/snippets/node_modules/is-regex/test/index.js b/docs/snippets/node_modules/is-regex/test/index.js index 93ea4e4a..f6c08023 100644 --- a/docs/snippets/node_modules/is-regex/test/index.js +++ b/docs/snippets/node_modules/is-regex/test/index.js @@ -1,7 +1,6 @@ 'use strict'; -var hasSymbols = require('has-symbols/shams')(); -var hasToStringTag = hasSymbols && !!Symbol.toStringTag; +var hasToStringTag = require('has-tostringtag/shams')(); var forEach = require('foreach'); var test = require('tape'); var isRegex = require('..'); diff --git a/docs/snippets/node_modules/is-shared-array-buffer/.eslintignore b/docs/snippets/node_modules/is-shared-array-buffer/.eslintignore new file mode 100644 index 00000000..404abb22 --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/docs/snippets/node_modules/is-shared-array-buffer/.eslintrc b/docs/snippets/node_modules/is-shared-array-buffer/.eslintrc new file mode 100644 index 00000000..be05ad8c --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/.eslintrc @@ -0,0 +1,18 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "operator-linebreak": [2, "before"], + }, + + "overrides": [ + { + "files": "test/**", + "globals": { + "SharedArrayBuffer": false, + }, + }, + ], +} diff --git a/docs/snippets/node_modules/is-shared-array-buffer/.github/FUNDING.yml b/docs/snippets/node_modules/is-shared-array-buffer/.github/FUNDING.yml new file mode 100644 index 00000000..61db3c4f --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/is-shared-array-buffer +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/docs/snippets/node_modules/is-shared-array-buffer/.nycrc b/docs/snippets/node_modules/is-shared-array-buffer/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/docs/snippets/node_modules/is-shared-array-buffer/CHANGELOG.md b/docs/snippets/node_modules/is-shared-array-buffer/CHANGELOG.md new file mode 100644 index 00000000..572eea21 --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.1](https://github.com/inspect-js/is-shared-array-buffer/compare/v1.0.0...v1.0.1) - 2021-03-04 + +### Commits + +- [readme] fix repo URLs [`37c38f3`](https://github.com/inspect-js/is-shared-array-buffer/commit/37c38f347392da177197dd2fd518b61240a56203) + +## v1.0.0 - 2021-03-04 + +### Commits + +- [Tests] add tests [`9c7b806`](https://github.com/inspect-js/is-shared-array-buffer/commit/9c7b806ab1528814308a7420f8198644f55c916f) +- Initial commit [`4e65c5e`](https://github.com/inspect-js/is-shared-array-buffer/commit/4e65c5ecdaa255162bc6507de4ff98cea2472e3b) +- [meta] do not publish github action workflow files [`ac3693d`](https://github.com/inspect-js/is-shared-array-buffer/commit/ac3693db8ec26db5444ef4b46aa38a81e8841d30) +- readme [`7a984d0`](https://github.com/inspect-js/is-shared-array-buffer/commit/7a984d0db73b77943f6731098134e3351a36793b) +- npm init [`a586c99`](https://github.com/inspect-js/is-shared-array-buffer/commit/a586c99316f3c8ae4fd5125621ea933e97a1bf1b) +- [actions] add automatic rebasing / merge commit blocking [`184fe62`](https://github.com/inspect-js/is-shared-array-buffer/commit/184fe622680d523e89ac322fa1a52dbba46a8fc0) +- Implementation [`207e26d`](https://github.com/inspect-js/is-shared-array-buffer/commit/207e26d1128930f28384cb213b38d69fd52bbd7c) +- [meta] create `FUNDING.yml`; add "funding" field [`3cad3fc`](https://github.com/inspect-js/is-shared-array-buffer/commit/3cad3fc9509f91fbc71e84565529f53a94d538d4) +- [meta] add auto-changelog [`31f1f2c`](https://github.com/inspect-js/is-shared-array-buffer/commit/31f1f2cbcd616d6c09089d62198d5cc775053324) +- [Tests] add `npm run lint` [`2e5146e`](https://github.com/inspect-js/is-shared-array-buffer/commit/2e5146e18f44533382a781fa09a50d4f47caa0e5) +- Only apps should have lockfiles [`7b2adfa`](https://github.com/inspect-js/is-shared-array-buffer/commit/7b2adfad6dcd95271ab6ba34658a9a1a21dbeacf) diff --git a/docs/snippets/node_modules/is-shared-array-buffer/LICENSE b/docs/snippets/node_modules/is-shared-array-buffer/LICENSE new file mode 100644 index 00000000..7948bc02 --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/snippets/node_modules/is-shared-array-buffer/index.js b/docs/snippets/node_modules/is-shared-array-buffer/index.js new file mode 100644 index 00000000..87043047 --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); + +var $byteLength = callBound('SharedArrayBuffer.prototype.byteLength', true); + +module.exports = $byteLength + ? function isSharedArrayBuffer(obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + try { + $byteLength(obj); + return true; + } catch (e) { + return false; + } + } + : function isSharedArrayBuffer(obj) { // eslint-disable-line no-unused-vars + return false; + }; diff --git a/docs/snippets/node_modules/is-shared-array-buffer/package.json b/docs/snippets/node_modules/is-shared-array-buffer/package.json new file mode 100644 index 00000000..505c5a3f --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/package.json @@ -0,0 +1,89 @@ +{ + "_from": "is-shared-array-buffer@^1.0.1", + "_id": "is-shared-array-buffer@1.0.1", + "_inBundle": false, + "_integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "_location": "/is-shared-array-buffer", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-shared-array-buffer@^1.0.1", + "name": "is-shared-array-buffer", + "escapedName": "is-shared-array-buffer", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/es-abstract" + ], + "_resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "_shasum": "97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6", + "_spec": "is-shared-array-buffer@^1.0.1", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "bugs": { + "url": "https://github.com/inspect-js/is-shared-array-buffer/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Is this value a JS SharedArrayBuffer?", + "devDependencies": { + "@ljharb/eslint-config": "^17.5.1", + "aud": "^1.1.4", + "auto-changelog": "^2.2.1", + "es-value-fixtures": "^1.2.1", + "eslint": "^7.21.0", + "for-each": "^0.3.3", + "nyc": "^10.3.2", + "object-inspect": "^1.9.0", + "tape": "^5.2.2" + }, + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "homepage": "https://github.com/inspect-js/is-shared-array-buffer#readme", + "keywords": [ + "javascript", + "ecmascript", + "is", + "sharedarraybuffer", + "shared", + "array", + "buffer" + ], + "license": "MIT", + "main": "index.js", + "name": "is-shared-array-buffer", + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/is-shared-array-buffer.git" + }, + "scripts": { + "lint": "eslint --ext=.js,.mjs .", + "posttest": "aud --production", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "pretest": "npm run lint", + "test": "npm run tests-only --", + "tests-only": "nyc tape 'test/**/*.js'", + "version": "auto-changelog && git add CHANGELOG.md" + }, + "version": "1.0.1" +} diff --git a/docs/snippets/node_modules/is-shared-array-buffer/test/index.js b/docs/snippets/node_modules/is-shared-array-buffer/test/index.js new file mode 100644 index 00000000..9bc2c562 --- /dev/null +++ b/docs/snippets/node_modules/is-shared-array-buffer/test/index.js @@ -0,0 +1,27 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var forEach = require('for-each'); +var v = require('es-value-fixtures'); + +var isSharedArrayBuffer = require('..'); + +test('isSharedArrayBuffer', function (t) { + t.equal(typeof isSharedArrayBuffer, 'function', 'is a function'); + + var nonSABs = v.primitives.concat(v.objects); + forEach(nonSABs, function (nonSAB) { + t.equal(isSharedArrayBuffer(nonSAB), false, inspect(nonSAB) + ' is not a SharedArrayBuffer'); + }); + + t.test('actual SharedArrayBuffer instances', { skip: typeof SharedArrayBuffer === 'undefined' }, function (st) { + var sab = new SharedArrayBuffer(); + + st.equal(isSharedArrayBuffer(sab), true, inspect(sab) + ' is a SharedArrayBuffer'); + + st.end(); + }); + + t.end(); +}); diff --git a/docs/snippets/node_modules/is-string/CHANGELOG.md b/docs/snippets/node_modules/is-string/CHANGELOG.md index 9334c53a..6f620438 100644 --- a/docs/snippets/node_modules/is-string/CHANGELOG.md +++ b/docs/snippets/node_modules/is-string/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +## [v1.0.7](https://github.com/inspect-js/is-string/compare/v1.0.6...v1.0.7) - 2021-08-05 + +### Commits + +- [Refactor] use `has-tostringtag` to behave correctly in the presence of symbol shams [`d973ffd`](https://github.com/inspect-js/is-string/commit/d973ffd2268e10c0e2cd4f0c57ecf8ce0a8d8578) +- [Dev Deps] update `auto-changelog`, `core-js`, `eslint`, `tape` [`4bfaabf`](https://github.com/inspect-js/is-string/commit/4bfaabf877e874ca21d2c44be26f13add8ee2761) + ## [v1.0.6](https://github.com/inspect-js/is-string/compare/v1.0.5...v1.0.6) - 2021-05-07 ### Commits diff --git a/docs/snippets/node_modules/is-string/index.js b/docs/snippets/node_modules/is-string/index.js index 5f77f03d..f44f7bbb 100644 --- a/docs/snippets/node_modules/is-string/index.js +++ b/docs/snippets/node_modules/is-string/index.js @@ -11,7 +11,7 @@ var tryStringObject = function tryStringObject(value) { }; var toStr = Object.prototype.toString; var strClass = '[object String]'; -var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; +var hasToStringTag = require('has-tostringtag/shams')(); module.exports = function isString(value) { if (typeof value === 'string') { diff --git a/docs/snippets/node_modules/is-string/package.json b/docs/snippets/node_modules/is-string/package.json index eb9015f9..7d925be2 100644 --- a/docs/snippets/node_modules/is-string/package.json +++ b/docs/snippets/node_modules/is-string/package.json @@ -1,28 +1,28 @@ { - "_from": "is-string@^1.0.6", - "_id": "is-string@1.0.6", + "_from": "is-string@^1.0.7", + "_id": "is-string@1.0.7", "_inBundle": false, - "_integrity": "sha512-2gdzbKUuqtQ3lYNrUTQYoClPhm7oQu4UdpSZMp1/DGgkHBT8E2Z1l0yMdb6D4zNAxwDiMv8MdulKROJGNl0Q0w==", + "_integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "_location": "/is-string", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "is-string@^1.0.6", + "raw": "is-string@^1.0.7", "name": "is-string", "escapedName": "is-string", - "rawSpec": "^1.0.6", + "rawSpec": "^1.0.7", "saveSpec": null, - "fetchSpec": "^1.0.6" + "fetchSpec": "^1.0.7" }, "_requiredBy": [ "/es-abstract", "/which-boxed-primitive" ], - "_resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.6.tgz", - "_shasum": "3fe5d5992fb0d93404f32584d4b0179a71b54a5f", - "_spec": "is-string@^1.0.6", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/es-abstract", + "_resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "_shasum": "0dd12bf2006f255bb58f695110eff7491eebc0fd", + "_spec": "is-string@^1.0.7", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" @@ -38,21 +38,24 @@ "url": "https://github.com/ljharb/is-string/issues" }, "bundleDependencies": false, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "deprecated": false, "description": "Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", "devDependencies": { "@ljharb/eslint-config": "^17.6.0", "aud": "^1.1.5", - "auto-changelog": "^2.2.1", - "core-js": "^3.12.0", + "auto-changelog": "^2.3.0", + "core-js": "^3.16.0", "eclint": "^2.8.1", - "eslint": "^7.26.0", + "eslint": "^7.32.0", "foreach": "^2.0.5", "indexof": "^0.0.1", "is": "^3.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^1.1.4", - "tape": "^5.2.2" + "tape": "^5.3.0" }, "engines": { "node": ">= 0.4" @@ -107,5 +110,5 @@ "android-browser/4.2" ] }, - "version": "1.0.6" + "version": "1.0.7" } diff --git a/docs/snippets/node_modules/is-string/test/index.js b/docs/snippets/node_modules/is-string/test/index.js index 8fbba42a..5239dfa4 100644 --- a/docs/snippets/node_modules/is-string/test/index.js +++ b/docs/snippets/node_modules/is-string/test/index.js @@ -2,7 +2,7 @@ var test = require('tape'); var isString = require('../'); -var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator !== 'undefined'; +var hasToStringTag = require('has-tostringtag/shams')(); test('not Strings', function (t) { t.notOk(isString(), 'undefined is not String'); @@ -22,7 +22,7 @@ test('not Strings', function (t) { t.end(); }); -test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { var fakeString = { toString: function () { return '7'; }, valueOf: function () { return '42'; } diff --git a/docs/snippets/node_modules/is-symbol/package.json b/docs/snippets/node_modules/is-symbol/package.json index 360f4cd0..4d7d38bd 100644 --- a/docs/snippets/node_modules/is-symbol/package.json +++ b/docs/snippets/node_modules/is-symbol/package.json @@ -22,7 +22,7 @@ "_resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", "_shasum": "a6dac93b635b063ca6872236de88910a57af139c", "_spec": "is-symbol@^1.0.2", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/es-to-primitive", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-to-primitive", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com" diff --git a/docs/snippets/node_modules/is-typed-array/.eslintrc b/docs/snippets/node_modules/is-typed-array/.eslintrc index 344c5b65..34a62620 100644 --- a/docs/snippets/node_modules/is-typed-array/.eslintrc +++ b/docs/snippets/node_modules/is-typed-array/.eslintrc @@ -3,6 +3,10 @@ "extends": "@ljharb", + "globals": { + "globalThis": false + }, + "rules": { "max-statements-per-line": [2, { "max": 2 }] }, diff --git a/docs/snippets/node_modules/is-typed-array/.nycrc b/docs/snippets/node_modules/is-typed-array/.nycrc index 1826526e..bdd626ce 100644 --- a/docs/snippets/node_modules/is-typed-array/.nycrc +++ b/docs/snippets/node_modules/is-typed-array/.nycrc @@ -2,10 +2,6 @@ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], - "lines": 86, - "statements": 85.93, - "functions": 82.43, - "branches": 76.06, "exclude": [ "coverage", "test" diff --git a/docs/snippets/node_modules/is-typed-array/CHANGELOG.md b/docs/snippets/node_modules/is-typed-array/CHANGELOG.md index e2f05739..886135ff 100644 --- a/docs/snippets/node_modules/is-typed-array/CHANGELOG.md +++ b/docs/snippets/node_modules/is-typed-array/CHANGELOG.md @@ -1,3 +1,23 @@ +1.1.8 / 2021-08-30 +================= + * [Refactor] use `globalThis` if available (#53) + * [Deps] update `available-typed-arrays` + * [Dev Deps] update `@ljharb/eslint-config` + +1.1.7 / 2021-08-07 +================= + * [Fix] if Symbol.toStringTag exists but is not present, use Object.prototype.toString + * [Dev Deps] update `is-callable`, `tape` + +1.1.6 / 2021-08-05 +================= + * [Fix] use `has-tostringtag` to behave correctly in the presence of symbol shams + * [readme] add actions and codecov badges + * [meta] use `prepublishOnly` script for npm 7+ + * [Deps] update `available-typed-arrays`, `es-abstract` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` + * [actions] use `node/install` instead of `node/run`; use `codecov` action + 1.1.5 / 2021-02-14 ================= * [meta] do not publish github action workflow files or nyc output diff --git a/docs/snippets/node_modules/is-typed-array/index.js b/docs/snippets/node_modules/is-typed-array/index.js index a769ced2..a5e6beec 100644 --- a/docs/snippets/node_modules/is-typed-array/index.js +++ b/docs/snippets/node_modules/is-typed-array/index.js @@ -5,9 +5,9 @@ var availableTypedArrays = require('available-typed-arrays'); var callBound = require('call-bind/callBound'); var $toString = callBound('Object.prototype.toString'); -var hasSymbols = require('has-symbols')(); -var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol'; +var hasToStringTag = require('has-tostringtag/shams')(); +var g = typeof globalThis === 'undefined' ? global : globalThis; var typedArrays = availableTypedArrays(); var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { @@ -24,17 +24,16 @@ var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); if (hasToStringTag && gOPD && getPrototypeOf) { forEach(typedArrays, function (typedArray) { - var arr = new global[typedArray](); - if (!(Symbol.toStringTag in arr)) { - throw new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.'); + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr) { + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; } - var proto = getPrototypeOf(arr); - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - descriptor = gOPD(superProto, Symbol.toStringTag); - } - toStrTags[typedArray] = descriptor.get; }); } @@ -52,7 +51,7 @@ var tryTypedArrays = function tryAllTypedArrays(value) { module.exports = function isTypedArray(value) { if (!value || typeof value !== 'object') { return false; } - if (!hasToStringTag) { + if (!hasToStringTag || !(Symbol.toStringTag in value)) { var tag = $slice($toString(value), 8, -1); return $indexOf(typedArrays, tag) > -1; } diff --git a/docs/snippets/node_modules/is-typed-array/package.json b/docs/snippets/node_modules/is-typed-array/package.json index aad13914..5f720373 100644 --- a/docs/snippets/node_modules/is-typed-array/package.json +++ b/docs/snippets/node_modules/is-typed-array/package.json @@ -1,8 +1,8 @@ { "_from": "is-typed-array@^1.1.3", - "_id": "is-typed-array@1.1.5", + "_id": "is-typed-array@1.1.8", "_inBundle": false, - "_integrity": "sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug==", + "_integrity": "sha512-HqH41TNZq2fgtGT8WHVFVJhBVGuY3AnP3Q36K8JKXUxSxRgk/d+7NjmwG2vo2mYmXK8UYZKu0qH8bVP5gEisjA==", "_location": "/is-typed-array", "_phantomChildren": {}, "_requested": { @@ -19,10 +19,10 @@ "/util", "/which-typed-array" ], - "_resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.5.tgz", - "_shasum": "f32e6e096455e329eb7b423862456aa213f0eb4e", + "_resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.8.tgz", + "_shasum": "cbaa6585dc7db43318bc5b89523ea384a6f65e79", "_spec": "is-typed-array@^1.1.3", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/util", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/util", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", @@ -40,26 +40,26 @@ } ], "dependencies": { - "available-typed-arrays": "^1.0.2", + "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", - "es-abstract": "^1.18.0-next.2", + "es-abstract": "^1.18.5", "foreach": "^2.0.5", - "has-symbols": "^1.0.1" + "has-tostringtag": "^1.0.0" }, "deprecated": false, "description": "Is this value a JS Typed Array? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag.", "devDependencies": { - "@ljharb/eslint-config": "^17.5.1", - "aud": "^1.1.4", - "eslint": "^7.20.0", + "@ljharb/eslint-config": "^18.0.0", + "aud": "^1.1.5", + "eslint": "^7.32.0", "evalmd": "^0.0.19", - "is-callable": "^1.2.3", + "is-callable": "^1.2.4", "make-arrow-function": "^1.2.0", "make-generator-function": "^2.0.0", "nyc": "^10.3.2", - "object-inspect": "^1.9.0", + "object-inspect": "^1.11.0", "safe-publish-latest": "^1.1.4", - "tape": "^5.1.1" + "tape": "^5.3.1" }, "engines": { "node": ">= 0.4" @@ -99,7 +99,8 @@ "lint": "eslint .", "posttest": "npx aud --production", "prelint": "evalmd README.md", - "prepublish": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", "pretest": "npm run --silent lint", "test": "npm run tests-only && npm run test:harmony", "test:harmony": "nyc node --harmony --es-staging test", @@ -123,5 +124,5 @@ "android-browser/4.2" ] }, - "version": "1.1.5" + "version": "1.1.8" } diff --git a/docs/snippets/node_modules/is-typed-array/test/index.js b/docs/snippets/node_modules/is-typed-array/test/index.js index e54700c8..803bfeba 100644 --- a/docs/snippets/node_modules/is-typed-array/test/index.js +++ b/docs/snippets/node_modules/is-typed-array/test/index.js @@ -3,7 +3,7 @@ var test = require('tape'); var isTypedArray = require('../'); var isCallable = require('is-callable'); -var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; +var hasToStringTag = require('has-tostringtag/shams')(); var generators = require('make-generator-function')(); var arrowFn = require('make-arrow-function')(); var forEach = require('foreach'); @@ -34,7 +34,6 @@ test('not arrays', function (t) { t.notOk(isTypedArray({}), 'object is not typed array'); t.notOk(isTypedArray(/a/g), 'regex literal is not typed array'); - // eslint-disable-next-line prefer-regex-literals t.notOk(isTypedArray(new RegExp('a', 'g')), 'regex object is not typed array'); t.notOk(isTypedArray(new Date()), 'new Date() is not typed array'); @@ -72,7 +71,7 @@ test('Arrow functions', { skip: !arrowFn }, function (t) { t.end(); }); -test('@@toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) { +test('@@toStringTag', { skip: !hasToStringTag }, function (t) { forEach(typedArrayNames, function (typedArray) { if (typeof global[typedArray] === 'function') { var fakeTypedArray = []; diff --git a/docs/snippets/node_modules/is-weakref/.eslintignore b/docs/snippets/node_modules/is-weakref/.eslintignore new file mode 100644 index 00000000..404abb22 --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/.eslintignore @@ -0,0 +1 @@ +coverage/ diff --git a/docs/snippets/node_modules/is-weakref/.eslintrc b/docs/snippets/node_modules/is-weakref/.eslintrc new file mode 100644 index 00000000..fe9b28ba --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "globals": { + "WeakRef": false, + }, + + "rules": { + "operator-linebreak": [2, "before"], + }, +} diff --git a/docs/snippets/node_modules/is-weakref/.github/FUNDING.yml b/docs/snippets/node_modules/is-weakref/.github/FUNDING.yml new file mode 100644 index 00000000..a9ccddf2 --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/is-weakref +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/docs/snippets/node_modules/is-arguments/.github/workflows/node-4+.yml b/docs/snippets/node_modules/is-weakref/.github/workflows/node-4+.yml similarity index 100% rename from docs/snippets/node_modules/is-arguments/.github/workflows/node-4+.yml rename to docs/snippets/node_modules/is-weakref/.github/workflows/node-4+.yml diff --git a/docs/snippets/node_modules/is-arguments/.github/workflows/node-iojs.yml b/docs/snippets/node_modules/is-weakref/.github/workflows/node-iojs.yml similarity index 100% rename from docs/snippets/node_modules/is-arguments/.github/workflows/node-iojs.yml rename to docs/snippets/node_modules/is-weakref/.github/workflows/node-iojs.yml diff --git a/docs/snippets/node_modules/is-arguments/.github/workflows/node-pretest.yml b/docs/snippets/node_modules/is-weakref/.github/workflows/node-pretest.yml similarity index 100% rename from docs/snippets/node_modules/is-arguments/.github/workflows/node-pretest.yml rename to docs/snippets/node_modules/is-weakref/.github/workflows/node-pretest.yml diff --git a/docs/snippets/node_modules/is-arguments/.github/workflows/node-zero.yml b/docs/snippets/node_modules/is-weakref/.github/workflows/node-zero.yml similarity index 100% rename from docs/snippets/node_modules/is-arguments/.github/workflows/node-zero.yml rename to docs/snippets/node_modules/is-weakref/.github/workflows/node-zero.yml diff --git a/docs/snippets/node_modules/is-arguments/.github/workflows/rebase.yml b/docs/snippets/node_modules/is-weakref/.github/workflows/rebase.yml similarity index 100% rename from docs/snippets/node_modules/is-arguments/.github/workflows/rebase.yml rename to docs/snippets/node_modules/is-weakref/.github/workflows/rebase.yml diff --git a/docs/snippets/node_modules/is-arguments/.github/workflows/require-allow-edits.yml b/docs/snippets/node_modules/is-weakref/.github/workflows/require-allow-edits.yml similarity index 100% rename from docs/snippets/node_modules/is-arguments/.github/workflows/require-allow-edits.yml rename to docs/snippets/node_modules/is-weakref/.github/workflows/require-allow-edits.yml diff --git a/docs/snippets/node_modules/is-weakref/.nycrc b/docs/snippets/node_modules/is-weakref/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/docs/snippets/node_modules/is-weakref/CHANGELOG.md b/docs/snippets/node_modules/is-weakref/CHANGELOG.md new file mode 100644 index 00000000..14eb2ee1 --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/CHANGELOG.md @@ -0,0 +1,34 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.1](https://github.com/inspect-js/is-weakref/compare/v1.0.0...v1.0.1) - 2020-12-04 + +### Commits + +- [Tests] migrate tests to Github Actions [`05b4faa`](https://github.com/inspect-js/is-weakref/commit/05b4faa167c67f42c792e35c07adcb6b87e7dea0) +- [Tests] run `nyc` on all tests [`8df2e4b`](https://github.com/inspect-js/is-weakref/commit/8df2e4bd66bb6b7d55f389f28e6bb167fe1deb5a) +- [actions] add "Allow Edits" workflow [`4a716b8`](https://github.com/inspect-js/is-weakref/commit/4a716b8fcc025fe889a0f09ccaee7a9f748b1c66) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect` [`be23cf3`](https://github.com/inspect-js/is-weakref/commit/be23cf305f46db8b1c8a26d1c74b096fdba00056) +- [Refactor] use `call-bind` instead of `es-abstract` [`a933a96`](https://github.com/inspect-js/is-weakref/commit/a933a9643ddf7cddfd9f9f3cf44d675cc4c86ce5) +- [actions] switch Automatic Rebase workflow to `pull_request_target` event [`4473ed2`](https://github.com/inspect-js/is-weakref/commit/4473ed2e73fed47cd2fa42b8d9cac17e941d2c08) +- [readme] remove travis badge [`bd3bfcd`](https://github.com/inspect-js/is-weakref/commit/bd3bfcd2c187099d2215232a7621fb960e1e2807) + +## v1.0.0 - 2020-08-01 + +### Commits + +- Initial commit [`dd86394`](https://github.com/inspect-js/is-weakref/commit/dd86394d7da000724c6e17c79077879c381e9ea3) +- readme [`f4defca`](https://github.com/inspect-js/is-weakref/commit/f4defcac48d1d99b019b596ab26bd868de1adfe9) +- Tests [`13d8139`](https://github.com/inspect-js/is-weakref/commit/13d8139dedf424239daf357261c39d3f8c33d662) +- npm init [`55a2bb7`](https://github.com/inspect-js/is-weakref/commit/55a2bb7c53b893396a51da969e352702cafe9a0e) +- Implementation [`1ec84e3`](https://github.com/inspect-js/is-weakref/commit/1ec84e36de4315d44c8da540faa27836832bb0f3) +- [meta] add auto-changelog [`ab9ce44`](https://github.com/inspect-js/is-weakref/commit/ab9ce44be717312c5221bf3d2f3f6d2dd8c6ac88) +- [actions] add automatic rebasing / merge commit blocking [`3d3f4d5`](https://github.com/inspect-js/is-weakref/commit/3d3f4d54bed6e455b2a0d0f20c87d454bf78af26) +- [meta] add "funding"; create `FUNDING.yml` [`f35ef3d`](https://github.com/inspect-js/is-weakref/commit/f35ef3de16eb06447acf3c39bdc164ba0e7bdf45) +- [Tests] add `npm run lint` [`af2123d`](https://github.com/inspect-js/is-weakref/commit/af2123d4754c14f7befa66ba01e1d72858723651) +- [Tests] use shared travis-ci configs [`042b4de`](https://github.com/inspect-js/is-weakref/commit/042b4dec08d882ae9137f4ad05ae24a1457da0f8) +- Only apps should have lockfiles [`fcae604`](https://github.com/inspect-js/is-weakref/commit/fcae604cb1422faae9311dd4219032895c0a9a2e) diff --git a/docs/snippets/node_modules/is-weakref/LICENSE b/docs/snippets/node_modules/is-weakref/LICENSE new file mode 100644 index 00000000..707437b5 --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/snippets/node_modules/is-weakref/index.js b/docs/snippets/node_modules/is-weakref/index.js new file mode 100644 index 00000000..90769f8a --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/index.js @@ -0,0 +1,21 @@ +'use strict'; + +var callBound = require('call-bind/callBound'); + +var $deref = callBound('WeakRef.prototype.deref', true); + +module.exports = typeof WeakRef === 'undefined' + ? function isWeakRef(value) { // eslint-disable-line no-unused-vars + return false; + } + : function isWeakRef(value) { + if (!value || typeof value !== 'object') { + return false; + } + try { + $deref(value); + return true; + } catch (e) { + return false; + } + }; diff --git a/docs/snippets/node_modules/is-weakref/package.json b/docs/snippets/node_modules/is-weakref/package.json new file mode 100644 index 00000000..48066295 --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/package.json @@ -0,0 +1,92 @@ +{ + "_from": "is-weakref@^1.0.1", + "_id": "is-weakref@1.0.1", + "_inBundle": false, + "_integrity": "sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ==", + "_location": "/is-weakref", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "is-weakref@^1.0.1", + "name": "is-weakref", + "escapedName": "is-weakref", + "rawSpec": "^1.0.1", + "saveSpec": null, + "fetchSpec": "^1.0.1" + }, + "_requiredBy": [ + "/es-abstract" + ], + "_resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.1.tgz", + "_shasum": "842dba4ec17fa9ac9850df2d6efbc1737274f2a2", + "_spec": "is-weakref@^1.0.1", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/es-abstract", + "author": { + "name": "Jordan Harband", + "email": "ljharb@gmail.com" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "bugs": { + "url": "https://github.com/inspect-js/is-weakref/issues" + }, + "bundleDependencies": false, + "dependencies": { + "call-bind": "^1.0.0" + }, + "deprecated": false, + "description": "Is this value a JS WeakRef? This module works cross-realm/iframe, and despite ES6 @@toStringTag.", + "devDependencies": { + "@ljharb/eslint-config": "^17.3.0", + "aud": "^1.1.3", + "auto-changelog": "^2.2.1", + "eslint": "^7.14.0", + "for-each": "^0.3.3", + "nyc": "^10.3.2", + "object-inspect": "^1.9.0", + "tape": "^5.0.1" + }, + "exports": { + ".": [ + { + "default": "./index.js" + }, + "./index.js" + ] + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "homepage": "https://github.com/inspect-js/is-weakref#readme", + "keywords": [ + "weakref", + "weak", + "ref", + "finalization", + "finalization registry" + ], + "license": "MIT", + "main": "index.js", + "name": "is-weakref", + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/is-weakref.git" + }, + "scripts": { + "lint": "eslint .", + "posttest": "aud --production", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "version": "auto-changelog && git add CHANGELOG.md" + }, + "version": "1.0.1" +} diff --git a/docs/snippets/node_modules/is-weakref/test/index.js b/docs/snippets/node_modules/is-weakref/test/index.js new file mode 100644 index 00000000..c1c5b6f9 --- /dev/null +++ b/docs/snippets/node_modules/is-weakref/test/index.js @@ -0,0 +1,26 @@ +'use strict'; + +var test = require('tape'); +var inspect = require('object-inspect'); +var forEach = require('for-each'); + +var isWeakRef = require('..'); + +test('isWeakRef', function (t) { + t.equal(typeof isWeakRef, 'function', 'is a function'); + + var nonWeakRefs = [undefined, null, true, false, 42, 0, Infinity, NaN, /a/g, function () {}, {}, []]; + forEach(nonWeakRefs, function (nonWeakRef) { + t.equal(isWeakRef(nonWeakRef), false, inspect(nonWeakRef) + ' is not a WeakRef'); + }); + + t.test('actual WeakRefs', { skip: typeof WeakRef === 'undefined' }, function (st) { + var ref = new WeakRef({}); + + st.equal(isWeakRef(ref), true, inspect(ref) + ' is a WeakRef'); + + st.end(); + }); + + t.end(); +}); diff --git a/docs/snippets/node_modules/isarray/package.json b/docs/snippets/node_modules/isarray/package.json index 464bde0a..45f6d6bd 100644 --- a/docs/snippets/node_modules/isarray/package.json +++ b/docs/snippets/node_modules/isarray/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", "_spec": "isarray@0.0.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/readable-stream", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/readable-stream", "author": { "name": "Julian Gruber", "email": "mail@juliangruber.com", diff --git a/docs/snippets/node_modules/isstream/package.json b/docs/snippets/node_modules/isstream/package.json index 8e469802..df4a65f5 100644 --- a/docs/snippets/node_modules/isstream/package.json +++ b/docs/snippets/node_modules/isstream/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "_shasum": "47e63f7af55afa6f92e1500e690eb8b8529c099a", "_spec": "isstream@0.1.x", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/winston", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/winston", "author": { "name": "Rod Vagg", "email": "rod@vagg.org" diff --git a/docs/snippets/node_modules/jquery/package.json b/docs/snippets/node_modules/jquery/package.json index b5b87b5c..a1394fa0 100644 --- a/docs/snippets/node_modules/jquery/package.json +++ b/docs/snippets/node_modules/jquery/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", "_shasum": "c72a09f15c1bdce142f49dbf1170bdf8adac2470", "_spec": "jquery@^3.5.1", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/jscoq", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/jscoq", "author": { "name": "OpenJS Foundation and other contributors", "url": "https://github.com/jquery/jquery/blob/3.6.0/AUTHORS.txt" diff --git a/docs/snippets/node_modules/js-tokens/package.json b/docs/snippets/node_modules/js-tokens/package.json index bf640162..5f700cc9 100644 --- a/docs/snippets/node_modules/js-tokens/package.json +++ b/docs/snippets/node_modules/js-tokens/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "_shasum": "19203fb59991df98e3a287050d4647cdeaf32499", "_spec": "js-tokens@^3.0.0 || ^4.0.0", - "_where": "/home/gares/MATHCOMP/mcb/coq/node_modules/loose-envify", + "_where": "/storage/current_data/mathcomp-book/1/coq/node_modules/loose-envify", "author": { "name": "Simon Lydell" }, diff --git a/docs/snippets/node_modules/jscoq/package.json b/docs/snippets/node_modules/jscoq/package.json index d822a726..4e3f9798 100644 --- a/docs/snippets/node_modules/jscoq/package.json +++ b/docs/snippets/node_modules/jscoq/package.json @@ -21,7 +21,7 @@ "_resolved": "https://registry.npmjs.org/jscoq/-/jscoq-0.12.3.tgz", "_shasum": "c74c9a4332c3eaf00765e89754e863e47efee3ef", "_spec": "jscoq@^0.12.3", - "_where": "/home/gares/MATHCOMP/mcb/coq", + "_where": "/storage/current_data/mathcomp-book/1/coq", "author": { "name": "ejgallego" }, diff --git a/docs/snippets/node_modules/jszip/CHANGES.md b/docs/snippets/node_modules/jszip/CHANGES.md index decb0fd3..f429968f 100644 --- a/docs/snippets/node_modules/jszip/CHANGES.md +++ b/docs/snippets/node_modules/jszip/CHANGES.md @@ -4,24 +4,34 @@ layout: default section: main --- -### v3.6.0 2020 2021-02-09 +### v3.7.1 2021-08-05 + +- Fix build of `dist` files. + + Note: this version ensures the changes from 3.7.0 are actually included in the `dist` files. Thanks to Evan W for reporting. + +### v3.7.0 2021-07-23 + +- Fix: Use a null prototype object for this.files (see [#766](https://github.com/Stuk/jszip/pull/766)) + + This change might break existing code if it uses prototype methods on the `.files` property of a zip object, for example `zip.files.toString()`. This approach is taken to prevent files in the zip overriding object methods that would exist on a normal object. + +### v3.6.0 2021-02-09 - Fix: redirect main to dist on browsers (see [#742](https://github.com/Stuk/jszip/pull/742)) - Fix duplicate require DataLengthProbe, utils (see [#734](https://github.com/Stuk/jszip/pull/734)) - Fix small error in read_zip.md (see [#703](https://github.com/Stuk/jszip/pull/703)) -### v3.5.0 2020 2020-05-31 +### v3.5.0 2020-05-31 - Fix 'End of data reached' error when file extra field is invalid (see [#544](https://github.com/Stuk/jszip/pull/544)). - Typescript definitions: Add null to return types of functions that may return null (see [#669](https://github.com/Stuk/jszip/pull/669)). - Typescript definitions: Correct nodeStream's type (see [#682](https://github.com/Stuk/jszip/pull/682)) - Typescript definitions: Add string output type (see [#666](https://github.com/Stuk/jszip/pull/666)) -### v3.4.0 2020 2020-04-19 +### v3.4.0 2020-04-19 - Add Typescript type definitions (see [#601](https://github.com/Stuk/jszip/pull/601)). -### v3.3.0 2020 2020-04-1 +### v3.3.0 2020-04-1 - Change browser module resolution to support Angular packager (see [#614](https://github.com/Stuk/jszip/pull/614)). diff --git a/docs/snippets/node_modules/jszip/dist/jszip.js b/docs/snippets/node_modules/jszip/dist/jszip.js index a46c3a03..9f0ffc1d 100644 --- a/docs/snippets/node_modules/jszip/dist/jszip.js +++ b/docs/snippets/node_modules/jszip/dist/jszip.js @@ -1,6 +1,6 @@ /*! -JSZip v3.6.0 - A JavaScript class for generating and reading zip files +JSZip v3.7.1 - A JavaScript class for generating and reading zip files (c) 2009-2016 Stuart Knightley @@ -11,20 +11,11360 @@ https://github.com/nodeca/pako/blob/master/LICENSE */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSZip = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -(c) 2009-2016 Stuart Knightley -Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown. +// public method for encoding +exports.encode = function(input) { + var output = []; + var chr1, chr2, chr3, enc1, enc2, enc3, enc4; + var i = 0, len = input.length, remainingBytes = len; -JSZip uses the library pako released under the MIT license : -https://github.com/nodeca/pako/blob/master/LICENSE + var isArray = utils.getTypeOf(input) !== "string"; + while (i < input.length) { + remainingBytes = len - i; + + if (!isArray) { + chr1 = input.charCodeAt(i++); + chr2 = i < len ? input.charCodeAt(i++) : 0; + chr3 = i < len ? input.charCodeAt(i++) : 0; + } else { + chr1 = input[i++]; + chr2 = i < len ? input[i++] : 0; + chr3 = i < len ? input[i++] : 0; + } + + enc1 = chr1 >> 2; + enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); + enc3 = remainingBytes > 1 ? (((chr2 & 15) << 2) | (chr3 >> 6)) : 64; + enc4 = remainingBytes > 2 ? (chr3 & 63) : 64; + + output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4)); + + } + + return output.join(""); +}; + +// public method for decoding +exports.decode = function(input) { + var chr1, chr2, chr3; + var enc1, enc2, enc3, enc4; + var i = 0, resultIndex = 0; + + var dataUrlPrefix = "data:"; + + if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) { + // This is a common error: people give a data url + // (data:image/png;base64,iVBOR...) with a {base64: true} and + // wonders why things don't work. + // We can detect that the string input looks like a data url but we + // *can't* be sure it is one: removing everything up to the comma would + // be too dangerous. + throw new Error("Invalid base64 input, it looks like a data url."); + } + + input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); + + var totalLength = input.length * 3 / 4; + if(input.charAt(input.length - 1) === _keyStr.charAt(64)) { + totalLength--; + } + if(input.charAt(input.length - 2) === _keyStr.charAt(64)) { + totalLength--; + } + if (totalLength % 1 !== 0) { + // totalLength is not an integer, the length does not match a valid + // base64 content. That can happen if: + // - the input is not a base64 content + // - the input is *almost* a base64 content, with a extra chars at the + // beginning or at the end + // - the input uses a base64 variant (base64url for example) + throw new Error("Invalid base64 input, bad content length."); + } + var output; + if (support.uint8array) { + output = new Uint8Array(totalLength|0); + } else { + output = new Array(totalLength|0); + } + + while (i < input.length) { + + enc1 = _keyStr.indexOf(input.charAt(i++)); + enc2 = _keyStr.indexOf(input.charAt(i++)); + enc3 = _keyStr.indexOf(input.charAt(i++)); + enc4 = _keyStr.indexOf(input.charAt(i++)); + + chr1 = (enc1 << 2) | (enc2 >> 4); + chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); + chr3 = ((enc3 & 3) << 6) | enc4; + + output[resultIndex++] = chr1; + + if (enc3 !== 64) { + output[resultIndex++] = chr2; + } + if (enc4 !== 64) { + output[resultIndex++] = chr3; + } + + } + + return output; +}; + +},{"./support":30,"./utils":32}],2:[function(require,module,exports){ +'use strict'; + +var external = require("./external"); +var DataWorker = require('./stream/DataWorker'); +var Crc32Probe = require('./stream/Crc32Probe'); +var DataLengthProbe = require('./stream/DataLengthProbe'); + +/** + * Represent a compressed object, with everything needed to decompress it. + * @constructor + * @param {number} compressedSize the size of the data compressed. + * @param {number} uncompressedSize the size of the data after decompression. + * @param {number} crc32 the crc32 of the decompressed file. + * @param {object} compression the type of compression, see lib/compressions.js. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data. + */ +function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) { + this.compressedSize = compressedSize; + this.uncompressedSize = uncompressedSize; + this.crc32 = crc32; + this.compression = compression; + this.compressedContent = data; +} + +CompressedObject.prototype = { + /** + * Create a worker to get the uncompressed content. + * @return {GenericWorker} the worker. + */ + getContentWorker: function () { + var worker = new DataWorker(external.Promise.resolve(this.compressedContent)) + .pipe(this.compression.uncompressWorker()) + .pipe(new DataLengthProbe("data_length")); + + var that = this; + worker.on("end", function () { + if (this.streamInfo['data_length'] !== that.uncompressedSize) { + throw new Error("Bug : uncompressed data size mismatch"); + } + }); + return worker; + }, + /** + * Create a worker to get the compressed content. + * @return {GenericWorker} the worker. + */ + getCompressedWorker: function () { + return new DataWorker(external.Promise.resolve(this.compressedContent)) + .withStreamInfo("compressedSize", this.compressedSize) + .withStreamInfo("uncompressedSize", this.uncompressedSize) + .withStreamInfo("crc32", this.crc32) + .withStreamInfo("compression", this.compression) + ; + } +}; + +/** + * Chain the given worker with other workers to compress the content with the + * given compression. + * @param {GenericWorker} uncompressedWorker the worker to pipe. + * @param {Object} compression the compression object. + * @param {Object} compressionOptions the options to use when compressing. + * @return {GenericWorker} the new worker compressing the content. + */ +CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) { + return uncompressedWorker + .pipe(new Crc32Probe()) + .pipe(new DataLengthProbe("uncompressedSize")) + .pipe(compression.compressWorker(compressionOptions)) + .pipe(new DataLengthProbe("compressedSize")) + .withStreamInfo("compression", compression); +}; + +module.exports = CompressedObject; + +},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(require,module,exports){ +'use strict'; + +var GenericWorker = require("./stream/GenericWorker"); + +exports.STORE = { + magic: "\x00\x00", + compressWorker : function (compressionOptions) { + return new GenericWorker("STORE compression"); + }, + uncompressWorker : function () { + return new GenericWorker("STORE decompression"); + } +}; +exports.DEFLATE = require('./flate'); + +},{"./flate":7,"./stream/GenericWorker":28}],4:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); + +/** + * The following functions come from pako, from pako/lib/zlib/crc32.js + * released under the MIT license, see pako https://github.com/nodeca/pako/ + */ + +// Use ordinary array, since untyped makes no boost here +function makeTable() { + var c, table = []; + + for(var n =0; n < 256; n++){ + c = n; + for(var k =0; k < 8; k++){ + c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } + + return table; +} + +// Create table on load. Just 255 signed longs. Not a problem. +var crcTable = makeTable(); + + +function crc32(crc, buf, len, pos) { + var t = crcTable, end = pos + len; + + crc = crc ^ (-1); + + for (var i = pos; i < end; i++ ) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; +} + +// That's all for the pako functions. + +/** + * Compute the crc32 of a string. + * This is almost the same as the function crc32, but for strings. Using the + * same function for the two use cases leads to horrible performances. + * @param {Number} crc the starting value of the crc. + * @param {String} str the string to use. + * @param {Number} len the length of the string. + * @param {Number} pos the starting position for the crc32 computation. + * @return {Number} the computed crc32. + */ +function crc32str(crc, str, len, pos) { + var t = crcTable, end = pos + len; + + crc = crc ^ (-1); + + for (var i = pos; i < end; i++ ) { + crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; +} + +module.exports = function crc32wrapper(input, crc) { + if (typeof input === "undefined" || !input.length) { + return 0; + } + + var isArray = utils.getTypeOf(input) !== "string"; + + if(isArray) { + return crc32(crc|0, input, input.length, 0); + } else { + return crc32str(crc|0, input, input.length, 0); + } +}; + +},{"./utils":32}],5:[function(require,module,exports){ +'use strict'; +exports.base64 = false; +exports.binary = false; +exports.dir = false; +exports.createFolders = true; +exports.date = null; +exports.compression = null; +exports.compressionOptions = null; +exports.comment = null; +exports.unixPermissions = null; +exports.dosPermissions = null; + +},{}],6:[function(require,module,exports){ +/* global Promise */ +'use strict'; + +// load the global object first: +// - it should be better integrated in the system (unhandledRejection in node) +// - the environment may have a custom Promise implementation (see zone.js) +var ES6Promise = null; +if (typeof Promise !== "undefined") { + ES6Promise = Promise; +} else { + ES6Promise = require("lie"); +} + +/** + * Let the user use/change some implementations. + */ +module.exports = { + Promise: ES6Promise +}; + +},{"lie":37}],7:[function(require,module,exports){ +'use strict'; +var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); + +var pako = require("pako"); +var utils = require("./utils"); +var GenericWorker = require("./stream/GenericWorker"); + +var ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array"; + +exports.magic = "\x08\x00"; + +/** + * Create a worker that uses pako to inflate/deflate. + * @constructor + * @param {String} action the name of the pako function to call : either "Deflate" or "Inflate". + * @param {Object} options the options to use when (de)compressing. + */ +function FlateWorker(action, options) { + GenericWorker.call(this, "FlateWorker/" + action); + + this._pako = null; + this._pakoAction = action; + this._pakoOptions = options; + // the `meta` object from the last chunk received + // this allow this worker to pass around metadata + this.meta = {}; +} + +utils.inherits(FlateWorker, GenericWorker); + +/** + * @see GenericWorker.processChunk + */ +FlateWorker.prototype.processChunk = function (chunk) { + this.meta = chunk.meta; + if (this._pako === null) { + this._createPako(); + } + this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); +}; + +/** + * @see GenericWorker.flush + */ +FlateWorker.prototype.flush = function () { + GenericWorker.prototype.flush.call(this); + if (this._pako === null) { + this._createPako(); + } + this._pako.push([], true); +}; +/** + * @see GenericWorker.cleanUp + */ +FlateWorker.prototype.cleanUp = function () { + GenericWorker.prototype.cleanUp.call(this); + this._pako = null; +}; + +/** + * Create the _pako object. + * TODO: lazy-loading this object isn't the best solution but it's the + * quickest. The best solution is to lazy-load the worker list. See also the + * issue #446. + */ +FlateWorker.prototype._createPako = function () { + this._pako = new pako[this._pakoAction]({ + raw: true, + level: this._pakoOptions.level || -1 // default compression + }); + var self = this; + this._pako.onData = function(data) { + self.push({ + data : data, + meta : self.meta + }); + }; +}; + +exports.compressWorker = function (compressionOptions) { + return new FlateWorker("Deflate", compressionOptions); +}; +exports.uncompressWorker = function () { + return new FlateWorker("Inflate", {}); +}; + +},{"./stream/GenericWorker":28,"./utils":32,"pako":38}],8:[function(require,module,exports){ +'use strict'; + +var utils = require('../utils'); +var GenericWorker = require('../stream/GenericWorker'); +var utf8 = require('../utf8'); +var crc32 = require('../crc32'); +var signature = require('../signature'); + +/** + * Transform an integer into a string in hexadecimal. + * @private + * @param {number} dec the number to convert. + * @param {number} bytes the number of bytes to generate. + * @returns {string} the result. + */ +var decToHex = function(dec, bytes) { + var hex = "", i; + for (i = 0; i < bytes; i++) { + hex += String.fromCharCode(dec & 0xff); + dec = dec >>> 8; + } + return hex; +}; + +/** + * Generate the UNIX part of the external file attributes. + * @param {Object} unixPermissions the unix permissions or null. + * @param {Boolean} isDir true if the entry is a directory, false otherwise. + * @return {Number} a 32 bit integer. + * + * adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute : + * + * TTTTsstrwxrwxrwx0000000000ADVSHR + * ^^^^____________________________ file type, see zipinfo.c (UNX_*) + * ^^^_________________________ setuid, setgid, sticky + * ^^^^^^^^^________________ permissions + * ^^^^^^^^^^______ not used ? + * ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only + */ +var generateUnixExternalFileAttr = function (unixPermissions, isDir) { + + var result = unixPermissions; + if (!unixPermissions) { + // I can't use octal values in strict mode, hence the hexa. + // 040775 => 0x41fd + // 0100664 => 0x81b4 + result = isDir ? 0x41fd : 0x81b4; + } + return (result & 0xFFFF) << 16; +}; + +/** + * Generate the DOS part of the external file attributes. + * @param {Object} dosPermissions the dos permissions or null. + * @param {Boolean} isDir true if the entry is a directory, false otherwise. + * @return {Number} a 32 bit integer. + * + * Bit 0 Read-Only + * Bit 1 Hidden + * Bit 2 System + * Bit 3 Volume Label + * Bit 4 Directory + * Bit 5 Archive + */ +var generateDosExternalFileAttr = function (dosPermissions, isDir) { + + // the dir flag is already set for compatibility + return (dosPermissions || 0) & 0x3F; +}; + +/** + * Generate the various parts used in the construction of the final zip file. + * @param {Object} streamInfo the hash with information about the compressed file. + * @param {Boolean} streamedContent is the content streamed ? + * @param {Boolean} streamingEnded is the stream finished ? + * @param {number} offset the current offset from the start of the zip file. + * @param {String} platform let's pretend we are this platform (change platform dependents fields) + * @param {Function} encodeFileName the function to encode the file name / comment. + * @return {Object} the zip parts. + */ +var generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) { + var file = streamInfo['file'], + compression = streamInfo['compression'], + useCustomEncoding = encodeFileName !== utf8.utf8encode, + encodedFileName = utils.transformTo("string", encodeFileName(file.name)), + utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), + comment = file.comment, + encodedComment = utils.transformTo("string", encodeFileName(comment)), + utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), + useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, + useUTF8ForComment = utfEncodedComment.length !== comment.length, + dosTime, + dosDate, + extraFields = "", + unicodePathExtraField = "", + unicodeCommentExtraField = "", + dir = file.dir, + date = file.date; + + + var dataInfo = { + crc32 : 0, + compressedSize : 0, + uncompressedSize : 0 + }; + + // if the content is streamed, the sizes/crc32 are only available AFTER + // the end of the stream. + if (!streamedContent || streamingEnded) { + dataInfo.crc32 = streamInfo['crc32']; + dataInfo.compressedSize = streamInfo['compressedSize']; + dataInfo.uncompressedSize = streamInfo['uncompressedSize']; + } + + var bitflag = 0; + if (streamedContent) { + // Bit 3: the sizes/crc32 are set to zero in the local header. + // The correct values are put in the data descriptor immediately + // following the compressed data. + bitflag |= 0x0008; + } + if (!useCustomEncoding && (useUTF8ForFileName || useUTF8ForComment)) { + // Bit 11: Language encoding flag (EFS). + bitflag |= 0x0800; + } + + + var extFileAttr = 0; + var versionMadeBy = 0; + if (dir) { + // dos or unix, we set the dos dir flag + extFileAttr |= 0x00010; + } + if(platform === "UNIX") { + versionMadeBy = 0x031E; // UNIX, version 3.0 + extFileAttr |= generateUnixExternalFileAttr(file.unixPermissions, dir); + } else { // DOS or other, fallback to DOS + versionMadeBy = 0x0014; // DOS, version 2.0 + extFileAttr |= generateDosExternalFileAttr(file.dosPermissions, dir); + } + + // date + // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html + // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html + + dosTime = date.getUTCHours(); + dosTime = dosTime << 6; + dosTime = dosTime | date.getUTCMinutes(); + dosTime = dosTime << 5; + dosTime = dosTime | date.getUTCSeconds() / 2; + + dosDate = date.getUTCFullYear() - 1980; + dosDate = dosDate << 4; + dosDate = dosDate | (date.getUTCMonth() + 1); + dosDate = dosDate << 5; + dosDate = dosDate | date.getUTCDate(); + + if (useUTF8ForFileName) { + // set the unicode path extra field. unzip needs at least one extra + // field to correctly handle unicode path, so using the path is as good + // as any other information. This could improve the situation with + // other archive managers too. + // This field is usually used without the utf8 flag, with a non + // unicode path in the header (winrar, winzip). This helps (a bit) + // with the messy Windows' default compressed folders feature but + // breaks on p7zip which doesn't seek the unicode path extra field. + // So for now, UTF-8 everywhere ! + unicodePathExtraField = + // Version + decToHex(1, 1) + + // NameCRC32 + decToHex(crc32(encodedFileName), 4) + + // UnicodeName + utfEncodedFileName; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x70" + + // size + decToHex(unicodePathExtraField.length, 2) + + // content + unicodePathExtraField; + } + + if(useUTF8ForComment) { + + unicodeCommentExtraField = + // Version + decToHex(1, 1) + + // CommentCRC32 + decToHex(crc32(encodedComment), 4) + + // UnicodeName + utfEncodedComment; + + extraFields += + // Info-ZIP Unicode Path Extra Field + "\x75\x63" + + // size + decToHex(unicodeCommentExtraField.length, 2) + + // content + unicodeCommentExtraField; + } + + var header = ""; + + // version needed to extract + header += "\x0A\x00"; + // general purpose bit flag + header += decToHex(bitflag, 2); + // compression method + header += compression.magic; + // last mod file time + header += decToHex(dosTime, 2); + // last mod file date + header += decToHex(dosDate, 2); + // crc-32 + header += decToHex(dataInfo.crc32, 4); + // compressed size + header += decToHex(dataInfo.compressedSize, 4); + // uncompressed size + header += decToHex(dataInfo.uncompressedSize, 4); + // file name length + header += decToHex(encodedFileName.length, 2); + // extra field length + header += decToHex(extraFields.length, 2); + + + var fileRecord = signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields; + + var dirRecord = signature.CENTRAL_FILE_HEADER + + // version made by (00: DOS) + decToHex(versionMadeBy, 2) + + // file header (common to file and central directory) + header + + // file comment length + decToHex(encodedComment.length, 2) + + // disk number start + "\x00\x00" + + // internal file attributes TODO + "\x00\x00" + + // external file attributes + decToHex(extFileAttr, 4) + + // relative offset of local header + decToHex(offset, 4) + + // file name + encodedFileName + + // extra field + extraFields + + // file comment + encodedComment; + + return { + fileRecord: fileRecord, + dirRecord: dirRecord + }; +}; + +/** + * Generate the EOCD record. + * @param {Number} entriesCount the number of entries in the zip file. + * @param {Number} centralDirLength the length (in bytes) of the central dir. + * @param {Number} localDirLength the length (in bytes) of the local dir. + * @param {String} comment the zip file comment as a binary string. + * @param {Function} encodeFileName the function to encode the comment. + * @return {String} the EOCD record. + */ +var generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) { + var dirEnd = ""; + var encodedComment = utils.transformTo("string", encodeFileName(comment)); + + // end of central dir signature + dirEnd = signature.CENTRAL_DIRECTORY_END + + // number of this disk + "\x00\x00" + + // number of the disk with the start of the central directory + "\x00\x00" + + // total number of entries in the central directory on this disk + decToHex(entriesCount, 2) + + // total number of entries in the central directory + decToHex(entriesCount, 2) + + // size of the central directory 4 bytes + decToHex(centralDirLength, 4) + + // offset of start of central directory with respect to the starting disk number + decToHex(localDirLength, 4) + + // .ZIP file comment length + decToHex(encodedComment.length, 2) + + // .ZIP file comment + encodedComment; + + return dirEnd; +}; + +/** + * Generate data descriptors for a file entry. + * @param {Object} streamInfo the hash generated by a worker, containing information + * on the file entry. + * @return {String} the data descriptors. + */ +var generateDataDescriptors = function (streamInfo) { + var descriptor = ""; + descriptor = signature.DATA_DESCRIPTOR + + // crc-32 4 bytes + decToHex(streamInfo['crc32'], 4) + + // compressed size 4 bytes + decToHex(streamInfo['compressedSize'], 4) + + // uncompressed size 4 bytes + decToHex(streamInfo['uncompressedSize'], 4); + + return descriptor; +}; + + +/** + * A worker to concatenate other workers to create a zip file. + * @param {Boolean} streamFiles `true` to stream the content of the files, + * `false` to accumulate it. + * @param {String} comment the comment to use. + * @param {String} platform the platform to use, "UNIX" or "DOS". + * @param {Function} encodeFileName the function to encode file names and comments. + */ +function ZipFileWorker(streamFiles, comment, platform, encodeFileName) { + GenericWorker.call(this, "ZipFileWorker"); + // The number of bytes written so far. This doesn't count accumulated chunks. + this.bytesWritten = 0; + // The comment of the zip file + this.zipComment = comment; + // The platform "generating" the zip file. + this.zipPlatform = platform; + // the function to encode file names and comments. + this.encodeFileName = encodeFileName; + // Should we stream the content of the files ? + this.streamFiles = streamFiles; + // If `streamFiles` is false, we will need to accumulate the content of the + // files to calculate sizes / crc32 (and write them *before* the content). + // This boolean indicates if we are accumulating chunks (it will change a lot + // during the lifetime of this worker). + this.accumulate = false; + // The buffer receiving chunks when accumulating content. + this.contentBuffer = []; + // The list of generated directory records. + this.dirRecords = []; + // The offset (in bytes) from the beginning of the zip file for the current source. + this.currentSourceOffset = 0; + // The total number of entries in this zip file. + this.entriesCount = 0; + // the name of the file currently being added, null when handling the end of the zip file. + // Used for the emitted metadata. + this.currentFile = null; + + + + this._sources = []; +} +utils.inherits(ZipFileWorker, GenericWorker); + +/** + * @see GenericWorker.push + */ +ZipFileWorker.prototype.push = function (chunk) { + + var currentFilePercent = chunk.meta.percent || 0; + var entriesCount = this.entriesCount; + var remainingFiles = this._sources.length; + + if(this.accumulate) { + this.contentBuffer.push(chunk); + } else { + this.bytesWritten += chunk.data.length; + + GenericWorker.prototype.push.call(this, { + data : chunk.data, + meta : { + currentFile : this.currentFile, + percent : entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100 + } + }); + } +}; + +/** + * The worker started a new source (an other worker). + * @param {Object} streamInfo the streamInfo object from the new source. + */ +ZipFileWorker.prototype.openedSource = function (streamInfo) { + this.currentSourceOffset = this.bytesWritten; + this.currentFile = streamInfo['file'].name; + + var streamedContent = this.streamFiles && !streamInfo['file'].dir; + + // don't stream folders (because they don't have any content) + if(streamedContent) { + var record = generateZipParts(streamInfo, streamedContent, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); + this.push({ + data : record.fileRecord, + meta : {percent:0} + }); + } else { + // we need to wait for the whole file before pushing anything + this.accumulate = true; + } +}; + +/** + * The worker finished a source (an other worker). + * @param {Object} streamInfo the streamInfo object from the finished source. + */ +ZipFileWorker.prototype.closedSource = function (streamInfo) { + this.accumulate = false; + var streamedContent = this.streamFiles && !streamInfo['file'].dir; + var record = generateZipParts(streamInfo, streamedContent, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName); + + this.dirRecords.push(record.dirRecord); + if(streamedContent) { + // after the streamed file, we put data descriptors + this.push({ + data : generateDataDescriptors(streamInfo), + meta : {percent:100} + }); + } else { + // the content wasn't streamed, we need to push everything now + // first the file record, then the content + this.push({ + data : record.fileRecord, + meta : {percent:0} + }); + while(this.contentBuffer.length) { + this.push(this.contentBuffer.shift()); + } + } + this.currentFile = null; +}; + +/** + * @see GenericWorker.flush + */ +ZipFileWorker.prototype.flush = function () { + + var localDirLength = this.bytesWritten; + for(var i = 0; i < this.dirRecords.length; i++) { + this.push({ + data : this.dirRecords[i], + meta : {percent:100} + }); + } + var centralDirLength = this.bytesWritten - localDirLength; + + var dirEnd = generateCentralDirectoryEnd(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName); + + this.push({ + data : dirEnd, + meta : {percent:100} + }); +}; + +/** + * Prepare the next source to be read. + */ +ZipFileWorker.prototype.prepareNextSource = function () { + this.previous = this._sources.shift(); + this.openedSource(this.previous.streamInfo); + if (this.isPaused) { + this.previous.pause(); + } else { + this.previous.resume(); + } +}; + +/** + * @see GenericWorker.registerPrevious + */ +ZipFileWorker.prototype.registerPrevious = function (previous) { + this._sources.push(previous); + var self = this; + + previous.on('data', function (chunk) { + self.processChunk(chunk); + }); + previous.on('end', function () { + self.closedSource(self.previous.streamInfo); + if(self._sources.length) { + self.prepareNextSource(); + } else { + self.end(); + } + }); + previous.on('error', function (e) { + self.error(e); + }); + return this; +}; + +/** + * @see GenericWorker.resume + */ +ZipFileWorker.prototype.resume = function () { + if(!GenericWorker.prototype.resume.call(this)) { + return false; + } + + if (!this.previous && this._sources.length) { + this.prepareNextSource(); + return true; + } + if (!this.previous && !this._sources.length && !this.generatedError) { + this.end(); + return true; + } +}; + +/** + * @see GenericWorker.error + */ +ZipFileWorker.prototype.error = function (e) { + var sources = this._sources; + if(!GenericWorker.prototype.error.call(this, e)) { + return false; + } + for(var i = 0; i < sources.length; i++) { + try { + sources[i].error(e); + } catch(e) { + // the `error` exploded, nothing to do + } + } + return true; +}; + +/** + * @see GenericWorker.lock + */ +ZipFileWorker.prototype.lock = function () { + GenericWorker.prototype.lock.call(this); + var sources = this._sources; + for(var i = 0; i < sources.length; i++) { + sources[i].lock(); + } +}; + +module.exports = ZipFileWorker; + +},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(require,module,exports){ +'use strict'; + +var compressions = require('../compressions'); +var ZipFileWorker = require('./ZipFileWorker'); + +/** + * Find the compression to use. + * @param {String} fileCompression the compression defined at the file level, if any. + * @param {String} zipCompression the compression defined at the load() level. + * @return {Object} the compression object to use. + */ +var getCompression = function (fileCompression, zipCompression) { + + var compressionName = fileCompression || zipCompression; + var compression = compressions[compressionName]; + if (!compression) { + throw new Error(compressionName + " is not a valid compression method !"); + } + return compression; +}; + +/** + * Create a worker to generate a zip file. + * @param {JSZip} zip the JSZip instance at the right root level. + * @param {Object} options to generate the zip file. + * @param {String} comment the comment to use. + */ +exports.generateWorker = function (zip, options, comment) { + + var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName); + var entriesCount = 0; + try { + + zip.forEach(function (relativePath, file) { + entriesCount++; + var compression = getCompression(file.options.compression, options.compression); + var compressionOptions = file.options.compressionOptions || options.compressionOptions || {}; + var dir = file.dir, date = file.date; + + file._compressWorker(compression, compressionOptions) + .withStreamInfo("file", { + name : relativePath, + dir : dir, + date : date, + comment : file.comment || "", + unixPermissions : file.unixPermissions, + dosPermissions : file.dosPermissions + }) + .pipe(zipFileWorker); + }); + zipFileWorker.entriesCount = entriesCount; + } catch (e) { + zipFileWorker.error(e); + } + + return zipFileWorker; +}; + +},{"../compressions":3,"./ZipFileWorker":8}],10:[function(require,module,exports){ +'use strict'; + +/** + * Representation a of zip file in js + * @constructor + */ +function JSZip() { + // if this constructor is used without `new`, it adds `new` before itself: + if(!(this instanceof JSZip)) { + return new JSZip(); + } + + if(arguments.length) { + throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide."); + } + + // object containing the files : + // { + // "folder/" : {...}, + // "folder/data.txt" : {...} + // } + // NOTE: we use a null prototype because we do not + // want filenames like "toString" coming from a zip file + // to overwrite methods and attributes in a normal Object. + this.files = Object.create(null); + + this.comment = null; + + // Where we are in the hierarchy + this.root = ""; + this.clone = function() { + var newObj = new JSZip(); + for (var i in this) { + if (typeof this[i] !== "function") { + newObj[i] = this[i]; + } + } + return newObj; + }; +} +JSZip.prototype = require('./object'); +JSZip.prototype.loadAsync = require('./load'); +JSZip.support = require('./support'); +JSZip.defaults = require('./defaults'); + +// TODO find a better way to handle this version, +// a require('package.json').version doesn't work with webpack, see #327 +JSZip.version = "3.7.1"; + +JSZip.loadAsync = function (content, options) { + return new JSZip().loadAsync(content, options); +}; + +JSZip.external = require("./external"); +module.exports = JSZip; + +},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(require,module,exports){ +'use strict'; +var utils = require('./utils'); +var external = require("./external"); +var utf8 = require('./utf8'); +var ZipEntries = require('./zipEntries'); +var Crc32Probe = require('./stream/Crc32Probe'); +var nodejsUtils = require("./nodejsUtils"); + +/** + * Check the CRC32 of an entry. + * @param {ZipEntry} zipEntry the zip entry to check. + * @return {Promise} the result. + */ +function checkEntryCRC32(zipEntry) { + return new external.Promise(function (resolve, reject) { + var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); + worker.on("error", function (e) { + reject(e); + }) + .on("end", function () { + if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { + reject(new Error("Corrupted zip : CRC32 mismatch")); + } else { + resolve(); + } + }) + .resume(); + }); +} + +module.exports = function (data, options) { + var zip = this; + options = utils.extend(options || {}, { + base64: false, + checkCRC32: false, + optimizedBinaryString: false, + createFolders: false, + decodeFileName: utf8.utf8decode + }); + + if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { + return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")); + } + + return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64) + .then(function (data) { + var zipEntries = new ZipEntries(options); + zipEntries.load(data); + return zipEntries; + }).then(function checkCRC32(zipEntries) { + var promises = [external.Promise.resolve(zipEntries)]; + var files = zipEntries.files; + if (options.checkCRC32) { + for (var i = 0; i < files.length; i++) { + promises.push(checkEntryCRC32(files[i])); + } + } + return external.Promise.all(promises); + }).then(function addFiles(results) { + var zipEntries = results.shift(); + var files = zipEntries.files; + for (var i = 0; i < files.length; i++) { + var input = files[i]; + zip.file(input.fileNameStr, input.decompressed, { + binary: true, + optimizedBinaryString: true, + date: input.date, + dir: input.dir, + comment: input.fileCommentStr.length ? input.fileCommentStr : null, + unixPermissions: input.unixPermissions, + dosPermissions: input.dosPermissions, + createFolders: options.createFolders + }); + } + if (zipEntries.zipComment.length) { + zip.comment = zipEntries.zipComment; + } + + return zip; + }); +}; + +},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(require,module,exports){ +"use strict"; + +var utils = require('../utils'); +var GenericWorker = require('../stream/GenericWorker'); + +/** + * A worker that use a nodejs stream as source. + * @constructor + * @param {String} filename the name of the file entry for this stream. + * @param {Readable} stream the nodejs stream. + */ +function NodejsStreamInputAdapter(filename, stream) { + GenericWorker.call(this, "Nodejs stream input adapter for " + filename); + this._upstreamEnded = false; + this._bindStream(stream); +} + +utils.inherits(NodejsStreamInputAdapter, GenericWorker); + +/** + * Prepare the stream and bind the callbacks on it. + * Do this ASAP on node 0.10 ! A lazy binding doesn't always work. + * @param {Stream} stream the nodejs stream to use. + */ +NodejsStreamInputAdapter.prototype._bindStream = function (stream) { + var self = this; + this._stream = stream; + stream.pause(); + stream + .on("data", function (chunk) { + self.push({ + data: chunk, + meta : { + percent : 0 + } + }); + }) + .on("error", function (e) { + if(self.isPaused) { + this.generatedError = e; + } else { + self.error(e); + } + }) + .on("end", function () { + if(self.isPaused) { + self._upstreamEnded = true; + } else { + self.end(); + } + }); +}; +NodejsStreamInputAdapter.prototype.pause = function () { + if(!GenericWorker.prototype.pause.call(this)) { + return false; + } + this._stream.pause(); + return true; +}; +NodejsStreamInputAdapter.prototype.resume = function () { + if(!GenericWorker.prototype.resume.call(this)) { + return false; + } + + if(this._upstreamEnded) { + this.end(); + } else { + this._stream.resume(); + } + + return true; +}; + +module.exports = NodejsStreamInputAdapter; + +},{"../stream/GenericWorker":28,"../utils":32}],13:[function(require,module,exports){ +'use strict'; + +var Readable = require('readable-stream').Readable; + +var utils = require('../utils'); +utils.inherits(NodejsStreamOutputAdapter, Readable); + +/** +* A nodejs stream using a worker as source. +* @see the SourceWrapper in http://nodejs.org/api/stream.html +* @constructor +* @param {StreamHelper} helper the helper wrapping the worker +* @param {Object} options the nodejs stream options +* @param {Function} updateCb the update callback. */ +function NodejsStreamOutputAdapter(helper, options, updateCb) { + Readable.call(this, options); + this._helper = helper; -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).JSZip=e()}}(function(){return function s(a,o,u){function h(r,e){if(!o[r]){if(!a[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(f)return f(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=o[r]={exports:{}};a[r][0].call(i.exports,function(e){var t=a[r][1][e];return h(t||e)},i,i.exports,s,a,o,u)}return o[r].exports}for(var f="function"==typeof require&&require,e=0;e>2,s=(3&t)<<4|r>>4,a=1>6:64,o=2>4,r=(15&i)<<4|(s=p.indexOf(e.charAt(o++)))>>2,n=(3&s)<<6|(a=p.indexOf(e.charAt(o++))),h[u++]=t,64!==s&&(h[u++]=r),64!==a&&(h[u++]=n);return h}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");function o(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}o.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},o.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=o},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(e){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),a=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==n.getTypeOf(e)?function(e,t,r){var n=a,i=0+r;e^=-1;for(var s=0;s>>8^n[255&(e^t[s])];return-1^e}(0|t,e,e.length):function(e,t,r){var n=a,i=0+r;e^=-1;for(var s=0;s>>8^n[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n;n="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("pako"),s=e("./utils"),a=e("./stream/GenericWorker"),o=n?"uint8array":"array";function u(e,t){a.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(u,a),u.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(o,e.data),!1)},u.prototype.flush=function(){a.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},r.compressWorker=function(e){return new u("Deflate",e)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function I(e,t){var r,n="";for(r=0;r>>=8;return n}function i(e,t,r,n,i,s){var a,o,u=e.file,h=e.compression,f=s!==B.utf8encode,l=O.transformTo("string",s(u.name)),d=O.transformTo("string",B.utf8encode(u.name)),c=u.comment,p=O.transformTo("string",s(c)),m=O.transformTo("string",B.utf8encode(c)),_=d.length!==u.name.length,g=m.length!==c.length,v="",b="",w="",y=u.dir,k=u.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var S=0;t&&(S|=8),f||!_&&!g||(S|=2048);var z,C=0,E=0;y&&(C|=16),"UNIX"===i?(E=798,C|=((z=u.unixPermissions)||(z=y?16893:33204),(65535&z)<<16)):(E=20,C|=63&(u.dosPermissions||0)),a=k.getUTCHours(),a<<=6,a|=k.getUTCMinutes(),a<<=5,a|=k.getUTCSeconds()/2,o=k.getUTCFullYear()-1980,o<<=4,o|=k.getUTCMonth()+1,o<<=5,o|=k.getUTCDate(),_&&(v+="up"+I((b=I(1,1)+I(R(l),4)+d).length,2)+b),g&&(v+="uc"+I((w=I(1,1)+I(R(p),4)+m).length,2)+w);var A="";return A+="\n\0",A+=I(S,2),A+=h.magic,A+=I(a,2),A+=I(o,2),A+=I(x.crc32,4),A+=I(x.compressedSize,4),A+=I(x.uncompressedSize,4),A+=I(l.length,2),A+=I(v.length,2),{fileRecord:T.LOCAL_FILE_HEADER+A+l+v,dirRecord:T.CENTRAL_FILE_HEADER+I(E,2)+A+I(p.length,2)+"\0\0\0\0"+I(C,4)+I(n,4)+l+v+p}}var O=e("../utils"),s=e("../stream/GenericWorker"),B=e("../utf8"),R=e("../crc32"),T=e("../signature");function n(e,t,r,n){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=n,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}O.inherits(n,s),n.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,s.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-n-1))/r:100}}))},n.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},n.prototype.closedSource=function(e){this.accumulate=!1;var t,r=this.streamFiles&&!e.file.dir,n=i(e,r,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),r)this.push({data:(t=e,T.DATA_DESCRIPTOR+I(t.crc32,4)+I(t.compressedSize,4)+I(t.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},n.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(e){},lastIndexOfSignature:function(e){},readAndCheckSignature:function(e){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(e){n.call(this,e)}e("../utils").inherits(i,n),i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),s=e("./ArrayReader"),a=e("./StringReader"),o=e("./NodeBufferReader"),u=e("./Uint8ArrayReader");t.exports=function(e){var t=n.getTypeOf(e);return n.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new o(e):i.uint8array?new u(n.transformTo("uint8array",e)):new s(n.transformTo("array",e)):new a(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function s(e){n.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,n),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function s(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,n),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}n.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}n.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r "+e:e}},t.exports=n},{}],29:[function(e,t,r){"use strict";var h=e("../utils"),i=e("./ConvertWorker"),s=e("./GenericWorker"),f=e("../base64"),n=e("../support"),a=e("../external"),o=null;if(n.nodestream)try{o=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function u(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,h.checkSupport(n),this._worker=e.pipe(new i(n)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}u.prototype={accumulate:function(e){return o=this,u=e,new a.Promise(function(t,r){var n=[],i=o._internalType,s=o._outputType,a=o._mimeType;o.on("data",function(e,t){n.push(e),u&&u(t)}).on("error",function(e){n=[],r(e)}).on("end",function(){try{var e=function(e,t,r){switch(e){case"blob":return h.newBlob(h.transformTo("arraybuffer",t),r);case"base64":return f.encode(t);default:return h.transformTo(e,t)}}(s,function(e,t){var r,n=0,i=null,s=0;for(r=0;r>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t}(e)},s.utf8decode=function(e){return u.nodebuffer?o.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,i,s=e.length,a=new Array(2*s);for(t=r=0;t>10&1023,a[r++]=56320|1023&n)}return a.length!==r&&(a.subarray?a=a.subarray(0,r):a.length=r),o.applyFromCharCode(a)}(e=o.transformTo(u.uint8array?"uint8array":"array",e))},o.inherits(a,n),a.prototype.processChunk=function(e){var t=o.transformTo(u.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(u.uint8array){var r=t;(t=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var n=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+h[e[r]]>t?r:t}(t),i=t;n!==t.length&&(u.uint8array?(i=t.subarray(0,n),this.leftOver=t.subarray(n,t.length)):(i=t.slice(0,n),this.leftOver=t.slice(n,t.length))),this.push({data:s.utf8decode(i),meta:e.meta})},a.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=a,o.inherits(f,n),f.prototype.processChunk=function(e){this.push({data:s.utf8encode(e.data),meta:e.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,o){"use strict";var u=e("./support"),h=e("./base64"),r=e("./nodejsUtils"),n=e("set-immediate-shim"),f=e("./external");function i(e){return e}function l(e,t){for(var r=0;r>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(e){if(this.extraFields[1]){var t=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=t.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=t.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=t.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=t.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(r<65536?t[s++]=224|r>>>12:(t[s++]=240|r>>>18,t[s++]=128|r>>>12&63),t[s++]=128|r>>>6&63),t[s++]=128|63&r);return t},r.buf2binstring=function(e){return f(e,e.length)},r.binstring2buf=function(e){for(var t=new u.Buf8(e.length),r=0,n=t.length;r>10&1023,o[n++]=56320|1023&i)}return f(o,n)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0?t:0===r?t:r+h[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,n){for(var i=65535&e|0,s=e>>>16&65535|0,a=0;0!==r;){for(r-=a=2e3>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var i=o,s=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var u,d=e("../utils/common"),h=e("./trees"),c=e("./adler32"),p=e("./crc32"),n=e("./messages"),f=0,l=0,m=-2,i=2,_=8,s=286,a=30,o=19,g=2*s+1,v=15,b=3,w=258,y=w+b+1,k=42,x=113;function S(e,t){return e.msg=n[t],t}function z(e){return(e<<1)-(4e.avail_out&&(r=e.avail_out),0!==r&&(d.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function A(e,t){h._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,E(e.strm)}function I(e,t){e.pending_buf[e.pending++]=t}function O(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function B(e,t){var r,n,i=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,u=e.strstart>e.w_size-y?e.strstart-(e.w_size-y):0,h=e.window,f=e.w_mask,l=e.prev,d=e.strstart+w,c=h[s+a-1],p=h[s+a];e.prev_length>=e.good_match&&(i>>=2),o>e.lookahead&&(o=e.lookahead);do{if(h[(r=t)+a]===p&&h[r+a-1]===c&&h[r]===h[s]&&h[++r]===h[s+1]){s+=2,r++;do{}while(h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&h[++s]===h[++r]&&su&&0!=--i);return a<=e.lookahead?a:e.lookahead}function R(e){var t,r,n,i,s,a,o,u,h,f,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-y)){for(d.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;n=e.head[--t],e.head[t]=l<=n?n-l:0,--r;);for(t=r=l;n=e.prev[--t],e.prev[t]=l<=n?n-l:0,--r;);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,o=e.window,u=e.strstart+e.lookahead,f=void 0,(h=i)<(f=a.avail_in)&&(f=h),r=0===f?0:(a.avail_in-=f,d.arraySet(o,a.input,a.next_in,f,u),1===a.state.wrap?a.adler=c(a.adler,o,f,u):2===a.state.wrap&&(a.adler=p(a.adler,o,f,u)),a.next_in+=f,a.total_in+=f,f),e.lookahead+=r,e.lookahead+e.insert>=b)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b)if(n=h._tr_tally(e,e.strstart-e.match_start,e.match_length-b),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=b){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=b&&(e.ins_h=(e.ins_h<=b&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-b,n=h._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-b),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(R(e),0===e.lookahead&&t===f)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,A(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-y&&(A(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(A(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(A(e,!1),e.strm.avail_out),1)}),new F(4,4,8,4,T),new F(4,5,16,8,T),new F(4,6,32,32,T),new F(4,4,16,16,D),new F(8,16,32,32,D),new F(8,16,128,128,D),new F(8,32,128,256,D),new F(32,128,258,1024,D),new F(32,258,258,4096,D)],r.deflateInit=function(e,t){return L(e,t,_,15,8,0)},r.deflateInit2=L,r.deflateReset=P,r.deflateResetKeep=U,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?m:(e.state.gzhead=t,l):m},r.deflate=function(e,t){var r,n,i,s;if(!e||!e.state||5>8&255),I(n,n.gzhead.time>>16&255),I(n,n.gzhead.time>>24&255),I(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),I(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(I(n,255&n.gzhead.extra.length),I(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=p(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(I(n,0),I(n,0),I(n,0),I(n,0),I(n,0),I(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),I(n,3),n.status=x);else{var a=_+(n.w_bits-8<<4)<<8;a|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=x,O(n,a),0!==n.strstart&&(O(n,e.adler>>>16),O(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),E(e),i=n.pending,n.pending!==n.pending_buf_size));)I(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),E(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),E(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}s=n.gzindexi&&(e.adler=p(e.adler,n.pending_buf,n.pending-i,i)),0===s&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&E(e),n.pending+2<=n.pending_buf_size&&(I(n,255&e.adler),I(n,e.adler>>8&255),e.adler=0,n.status=x)):n.status=x),0!==n.pending){if(E(e),0===e.avail_out)return n.last_flush=-1,l}else if(0===e.avail_in&&z(t)<=z(r)&&4!==t)return S(e,-5);if(666===n.status&&0!==e.avail_in)return S(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==f&&666!==n.status){var o=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(R(e),0===e.lookahead)){if(t===f)return 1;break}if(e.match_length=0,r=h._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(A(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(A(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,s,a=e.window;;){if(e.lookahead<=w){if(R(e),e.lookahead<=w&&t===f)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=b&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=b?(r=h._tr_tally(e,1,e.match_length-b),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=h._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(A(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(A(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?1:2}(n,t):u[n.level].func(n,t);if(3!==o&&4!==o||(n.status=666),1===o||3===o)return 0===e.avail_out&&(n.last_flush=-1),l;if(2===o&&(1===t?h._tr_align(n):5!==t&&(h._tr_stored_block(n,0,0,!1),3===t&&(C(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),E(e),0===e.avail_out))return n.last_flush=-1,l}return 4!==t?l:n.wrap<=0?1:(2===n.wrap?(I(n,255&e.adler),I(n,e.adler>>8&255),I(n,e.adler>>16&255),I(n,e.adler>>24&255),I(n,255&e.total_in),I(n,e.total_in>>8&255),I(n,e.total_in>>16&255),I(n,e.total_in>>24&255)):(O(n,e.adler>>>16),O(n,65535&e.adler)),E(e),0=r.w_size&&(0===s&&(C(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new d.Buf8(r.w_size),d.arraySet(h,t,f-r.w_size,r.w_size,0),t=h,f=r.w_size),a=e.avail_in,o=e.next_in,u=e.input,e.avail_in=f,e.next_in=0,e.input=t,R(r);r.lookahead>=b;){for(n=r.strstart,i=r.lookahead-(b-1);r.ins_h=(r.ins_h<>>=w=b>>>24,p-=w,0==(w=b>>>16&255))C[s++]=65535&b;else{if(!(16&w)){if(0==(64&w)){b=m[(65535&b)+(c&(1<>>=w,p-=w),p<15&&(c+=z[n++]<>>=w=b>>>24,p-=w,!(16&(w=b>>>16&255))){if(0==(64&w)){b=_[(65535&b)+(c&(1<>>=w,p-=w,(w=s-a)>3,c&=(1<<(p-=y<<3))-1,e.next_in=n,e.next_out=s,e.avail_in=n>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function s(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new I.Buf16(320),this.work=new I.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=P,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new I.Buf32(n),t.distcode=t.distdyn=new I.Buf32(i),t.sane=1,t.back=-1,N):U}function o(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,a(e)):U}function u(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=s.wsize?(I.arraySet(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n<(i=s.wsize-s.wnext)&&(i=n),I.arraySet(s.window,t,r-n,i,s.wnext),(n-=i)?(I.arraySet(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=B(r.check,E,2,0),f=h=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&h)){e.msg="unknown compression method",r.mode=30;break}if(f-=4,k=8+(15&(h>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<>8&1),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=B(r.check,E,2,0)),f=h=0,r.mode=3;case 3:for(;f<32;){if(0===o)break e;o--,h+=n[s++]<>>8&255,E[2]=h>>>16&255,E[3]=h>>>24&255,r.check=B(r.check,E,4,0)),f=h=0,r.mode=4;case 4:for(;f<16;){if(0===o)break e;o--,h+=n[s++]<>8),512&r.flags&&(E[0]=255&h,E[1]=h>>>8&255,r.check=B(r.check,E,2,0)),f=h=0,r.mode=5;case 5:if(1024&r.flags){for(;f<16;){if(0===o)break e;o--,h+=n[s++]<>>8&255,r.check=B(r.check,E,2,0)),f=h=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(o<(c=r.length)&&(c=o),c&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),I.arraySet(r.head.extra,n,s,c,k)),512&r.flags&&(r.check=B(r.check,n,c,s)),o-=c,s+=c,r.length-=c),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===o)break e;for(c=0;k=n[s+c++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&c>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;f<32;){if(0===o)break e;o--,h+=n[s++]<>>=7&f,f-=7&f,r.mode=27;break}for(;f<3;){if(0===o)break e;o--,h+=n[s++]<>>=1)){case 0:r.mode=14;break;case 1:if(j(r),r.mode=20,6!==t)break;h>>>=2,f-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}h>>>=2,f-=2;break;case 14:for(h>>>=7&f,f-=7&f;f<32;){if(0===o)break e;o--,h+=n[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&h,f=h=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(c=r.length){if(o>>=5,f-=5,r.ndist=1+(31&h),h>>>=5,f-=5,r.ncode=4+(15&h),h>>>=4,f-=4,286>>=3,f-=3}for(;r.have<19;)r.lens[A[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},x=T(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,v=65535&C,!((_=C>>>24)<=f);){if(0===o)break e;o--,h+=n[s++]<>>=_,f-=_,r.lens[r.have++]=v;else{if(16===v){for(z=_+2;f>>=_,f-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],c=3+(3&h),h>>>=2,f-=2}else if(17===v){for(z=_+3;f>>=_)),h>>>=3,f-=3}else{for(z=_+7;f>>=_)),h>>>=7,f-=7}if(r.have+c>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;c--;)r.lens[r.have++]=k}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,S={bits:r.lenbits},x=T(D,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,x){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},x=T(F,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,x){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=o&&258<=u){e.next_out=a,e.avail_out=u,e.next_in=s,e.avail_in=o,r.hold=h,r.bits=f,R(e,d),a=e.next_out,i=e.output,u=e.avail_out,s=e.next_in,n=e.input,o=e.avail_in,h=r.hold,f=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;g=(C=r.lencode[h&(1<>>16&255,v=65535&C,!((_=C>>>24)<=f);){if(0===o)break e;o--,h+=n[s++]<>b)])>>>16&255,v=65535&C,!(b+(_=C>>>24)<=f);){if(0===o)break e;o--,h+=n[s++]<>>=b,f-=b,r.back+=b}if(h>>>=_,f-=_,r.back+=_,r.length=v,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=12;break}if(64&g){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(z=r.extra;f>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(C=r.distcode[h&(1<>>16&255,v=65535&C,!((_=C>>>24)<=f);){if(0===o)break e;o--,h+=n[s++]<>b)])>>>16&255,v=65535&C,!(b+(_=C>>>24)<=f);){if(0===o)break e;o--,h+=n[s++]<>>=b,f-=b,r.back+=b}if(h>>>=_,f-=_,r.back+=_,64&g){e.msg="invalid distance code",r.mode=30;break}r.offset=v,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(z=r.extra;f>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===u)break e;if(c=d-u,r.offset>c){if((c=r.offset-c)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}p=c>r.wnext?(c-=r.wnext,r.wsize-c):r.wnext-c,c>r.length&&(c=r.length),m=r.window}else m=i,p=a-r.offset,c=r.length;for(uc?(m=R[T+a[b]],A[I+a[b]]):(m=96,0),u=1<>S)+(h-=u)]=p<<24|m<<16|_|0,0!==h;);for(u=1<>=1;if(0!==u?(E&=u-1,E+=u):E=0,b++,0==--O[v]){if(v===y)break;v=t[r+a[b]]}if(k>>7)]}function x(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function S(e,t,r){e.bi_valid>i-r?(e.bi_buf|=t<>i-e.bi_valid,e.bi_valid+=r-i):(e.bi_buf|=t<>>=1,r<<=1,0<--t;);return r>>>1}function E(e,t,r){var n,i,s=new Array(_+1),a=0;for(n=1;n<=_;n++)s[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var o=e[2*i+1];0!==o&&(e[2*i]=C(s[o]++,o))}}function A(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function I(e){8>1;1<=r;r--)B(e,s,r);for(i=u;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],B(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,s[2*i]=s[2*r]+s[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,s[2*r+1]=s[2*n+1]=i,e.heap[1]=i++,B(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,s,a,o,u=t.dyn_tree,h=t.max_code,f=t.stat_desc.static_tree,l=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,c=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(s=0;s<=_;s++)e.bl_count[s]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)p<(s=u[2*u[2*(n=e.heap[r])+1]+1]+1)&&(s=p,m++),u[2*n+1]=s,h>=7;n<30;n++)for(w[n]=i<<7,e=0;e<1<>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),T(e,e.l_desc),T(e,e.d_desc),a=function(e){var t;for(D(e,e.dyn_ltree,e.l_desc.max_code),D(e,e.dyn_dtree,e.d_desc.max_code),T(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*f[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=i&&(i=s)):i=s=r+5,r+4<=i&&-1!==t?U(e,t,r,n):4===e.strategy||s===i?(S(e,2+(n?1:0),3),R(e,l,d)):(S(e,4+(n?1:0),3),function(e,t,r,n){var i;for(S(e,t-257,5),S(e,r-1,5),S(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(p[r]+256+1)]++,e.dyn_dtree[2*k(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){var t;S(e,2,3),z(e,256,l),16===(t=e).bi_valid?(x(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):8<=t.bi_valid&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){"use strict";t.exports="function"==typeof setImmediate?setImmediate:function(){var e=[].slice.apply(arguments);e.splice(1,0,0),setTimeout.apply(null,e)}},{}]},{},[10])(10)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}]},{},[1])(1) + var self = this; + helper.on("data", function (data, meta) { + if (!self.push(data)) { + self._helper.pause(); + } + if(updateCb) { + updateCb(meta); + } + }) + .on("error", function(e) { + self.emit('error', e); + }) + .on("end", function () { + self.push(null); + }); +} + + +NodejsStreamOutputAdapter.prototype._read = function() { + this._helper.resume(); +}; + +module.exports = NodejsStreamOutputAdapter; + +},{"../utils":32,"readable-stream":16}],14:[function(require,module,exports){ +'use strict'; + +module.exports = { + /** + * True if this is running in Nodejs, will be undefined in a browser. + * In a browser, browserify won't include this file and the whole module + * will be resolved an empty object. + */ + isNode : typeof Buffer !== "undefined", + /** + * Create a new nodejs Buffer from an existing content. + * @param {Object} data the data to pass to the constructor. + * @param {String} encoding the encoding to use. + * @return {Buffer} a new Buffer. + */ + newBufferFrom: function(data, encoding) { + if (Buffer.from && Buffer.from !== Uint8Array.from) { + return Buffer.from(data, encoding); + } else { + if (typeof data === "number") { + // Safeguard for old Node.js versions. On newer versions, + // Buffer.from(number) / Buffer(number, encoding) already throw. + throw new Error("The \"data\" argument must not be a number"); + } + return new Buffer(data, encoding); + } + }, + /** + * Create a new nodejs Buffer with the specified size. + * @param {Integer} size the size of the buffer. + * @return {Buffer} a new Buffer. + */ + allocBuffer: function (size) { + if (Buffer.alloc) { + return Buffer.alloc(size); + } else { + var buf = new Buffer(size); + buf.fill(0); + return buf; + } + }, + /** + * Find out if an object is a Buffer. + * @param {Object} b the object to test. + * @return {Boolean} true if the object is a Buffer, false otherwise. + */ + isBuffer : function(b){ + return Buffer.isBuffer(b); + }, + + isStream : function (obj) { + return obj && + typeof obj.on === "function" && + typeof obj.pause === "function" && + typeof obj.resume === "function"; + } +}; + +},{}],15:[function(require,module,exports){ +'use strict'; +var utf8 = require('./utf8'); +var utils = require('./utils'); +var GenericWorker = require('./stream/GenericWorker'); +var StreamHelper = require('./stream/StreamHelper'); +var defaults = require('./defaults'); +var CompressedObject = require('./compressedObject'); +var ZipObject = require('./zipObject'); +var generate = require("./generate"); +var nodejsUtils = require("./nodejsUtils"); +var NodejsStreamInputAdapter = require("./nodejs/NodejsStreamInputAdapter"); + + +/** + * Add a file in the current folder. + * @private + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file + * @param {Object} originalOptions the options of the file + * @return {Object} the new file. + */ +var fileAdd = function(name, data, originalOptions) { + // be sure sub folders exist + var dataType = utils.getTypeOf(data), + parent; + + + /* + * Correct options. + */ + + var o = utils.extend(originalOptions || {}, defaults); + o.date = o.date || new Date(); + if (o.compression !== null) { + o.compression = o.compression.toUpperCase(); + } + + if (typeof o.unixPermissions === "string") { + o.unixPermissions = parseInt(o.unixPermissions, 8); + } + + // UNX_IFDIR 0040000 see zipinfo.c + if (o.unixPermissions && (o.unixPermissions & 0x4000)) { + o.dir = true; + } + // Bit 4 Directory + if (o.dosPermissions && (o.dosPermissions & 0x0010)) { + o.dir = true; + } + + if (o.dir) { + name = forceTrailingSlash(name); + } + if (o.createFolders && (parent = parentFolder(name))) { + folderAdd.call(this, parent, true); + } + + var isUnicodeString = dataType === "string" && o.binary === false && o.base64 === false; + if (!originalOptions || typeof originalOptions.binary === "undefined") { + o.binary = !isUnicodeString; + } + + + var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0; + + if (isCompressedEmpty || o.dir || !data || data.length === 0) { + o.base64 = false; + o.binary = true; + data = ""; + o.compression = "STORE"; + dataType = "string"; + } + + /* + * Convert content to fit. + */ + + var zipObjectContent = null; + if (data instanceof CompressedObject || data instanceof GenericWorker) { + zipObjectContent = data; + } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) { + zipObjectContent = new NodejsStreamInputAdapter(name, data); + } else { + zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64); + } + + var object = new ZipObject(name, zipObjectContent, o); + this.files[name] = object; + /* + TODO: we can't throw an exception because we have async promises + (we can have a promise of a Date() for example) but returning a + promise is useless because file(name, data) returns the JSZip + object for chaining. Should we break that to allow the user + to catch the error ? + + return external.Promise.resolve(zipObjectContent) + .then(function () { + return object; + }); + */ +}; + +/** + * Find the parent folder of the path. + * @private + * @param {string} path the path to use + * @return {string} the parent folder, or "" + */ +var parentFolder = function (path) { + if (path.slice(-1) === '/') { + path = path.substring(0, path.length - 1); + } + var lastSlash = path.lastIndexOf('/'); + return (lastSlash > 0) ? path.substring(0, lastSlash) : ""; +}; + +/** + * Returns the path with a slash at the end. + * @private + * @param {String} path the path to check. + * @return {String} the path with a trailing slash. + */ +var forceTrailingSlash = function(path) { + // Check the name ends with a / + if (path.slice(-1) !== "/") { + path += "/"; // IE doesn't like substr(-1) + } + return path; +}; + +/** + * Add a (sub) folder in the current folder. + * @private + * @param {string} name the folder's name + * @param {boolean=} [createFolders] If true, automatically create sub + * folders. Defaults to false. + * @return {Object} the new folder. + */ +var folderAdd = function(name, createFolders) { + createFolders = (typeof createFolders !== 'undefined') ? createFolders : defaults.createFolders; + + name = forceTrailingSlash(name); + + // Does this folder already exist? + if (!this.files[name]) { + fileAdd.call(this, name, null, { + dir: true, + createFolders: createFolders + }); + } + return this.files[name]; +}; + +/** +* Cross-window, cross-Node-context regular expression detection +* @param {Object} object Anything +* @return {Boolean} true if the object is a regular expression, +* false otherwise +*/ +function isRegExp(object) { + return Object.prototype.toString.call(object) === "[object RegExp]"; +} + +// return the actual prototype of JSZip +var out = { + /** + * @see loadAsync + */ + load: function() { + throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); + }, + + + /** + * Call a callback function for each entry at this folder level. + * @param {Function} cb the callback function: + * function (relativePath, file) {...} + * It takes 2 arguments : the relative path and the file. + */ + forEach: function(cb) { + var filename, relativePath, file; + /* jshint ignore:start */ + // ignore warning about unwanted properties because this.files is a null prototype object + for (filename in this.files) { + file = this.files[filename]; + relativePath = filename.slice(this.root.length, filename.length); + if (relativePath && filename.slice(0, this.root.length) === this.root) { // the file is in the current root + cb(relativePath, file); // TODO reverse the parameters ? need to be clean AND consistent with the filter search fn... + } + } + /* jshint ignore:end */ + }, + + /** + * Filter nested files/folders with the specified function. + * @param {Function} search the predicate to use : + * function (relativePath, file) {...} + * It takes 2 arguments : the relative path and the file. + * @return {Array} An array of matching elements. + */ + filter: function(search) { + var result = []; + this.forEach(function (relativePath, entry) { + if (search(relativePath, entry)) { // the file matches the function + result.push(entry); + } + + }); + return result; + }, + + /** + * Add a file to the zip file, or search a file. + * @param {string|RegExp} name The name of the file to add (if data is defined), + * the name of the file to find (if no data) or a regex to match files. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded + * @param {Object} o File options + * @return {JSZip|Object|Array} this JSZip object (when adding a file), + * a file (when searching by string) or an array of files (when searching by regex). + */ + file: function(name, data, o) { + if (arguments.length === 1) { + if (isRegExp(name)) { + var regexp = name; + return this.filter(function(relativePath, file) { + return !file.dir && regexp.test(relativePath); + }); + } + else { // text + var obj = this.files[this.root + name]; + if (obj && !obj.dir) { + return obj; + } else { + return null; + } + } + } + else { // more than one argument : we have data ! + name = this.root + name; + fileAdd.call(this, name, data, o); + } + return this; + }, + + /** + * Add a directory to the zip file, or search. + * @param {String|RegExp} arg The name of the directory to add, or a regex to search folders. + * @return {JSZip} an object with the new directory as the root, or an array containing matching folders. + */ + folder: function(arg) { + if (!arg) { + return this; + } + + if (isRegExp(arg)) { + return this.filter(function(relativePath, file) { + return file.dir && arg.test(relativePath); + }); + } + + // else, name is a new folder + var name = this.root + arg; + var newFolder = folderAdd.call(this, name); + + // Allow chaining by returning a new object with this folder as the root + var ret = this.clone(); + ret.root = newFolder.name; + return ret; + }, + + /** + * Delete a file, or a directory and all sub-files, from the zip + * @param {string} name the name of the file to delete + * @return {JSZip} this JSZip object + */ + remove: function(name) { + name = this.root + name; + var file = this.files[name]; + if (!file) { + // Look for any folders + if (name.slice(-1) !== "/") { + name += "/"; + } + file = this.files[name]; + } + + if (file && !file.dir) { + // file + delete this.files[name]; + } else { + // maybe a folder, delete recursively + var kids = this.filter(function(relativePath, file) { + return file.name.slice(0, name.length) === name; + }); + for (var i = 0; i < kids.length; i++) { + delete this.files[kids[i].name]; + } + } + + return this; + }, + + /** + * Generate the complete zip file + * @param {Object} options the options to generate the zip file : + * - compression, "STORE" by default. + * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. + * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the zip file + */ + generate: function(options) { + throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); + }, + + /** + * Generate the complete zip file as an internal stream. + * @param {Object} options the options to generate the zip file : + * - compression, "STORE" by default. + * - type, "base64" by default. Values are : string, base64, uint8array, arraybuffer, blob. + * @return {StreamHelper} the streamed zip file. + */ + generateInternalStream: function(options) { + var worker, opts = {}; + try { + opts = utils.extend(options || {}, { + streamFiles: false, + compression: "STORE", + compressionOptions : null, + type: "", + platform: "DOS", + comment: null, + mimeType: 'application/zip', + encodeFileName: utf8.utf8encode + }); + + opts.type = opts.type.toLowerCase(); + opts.compression = opts.compression.toUpperCase(); + + // "binarystring" is preferred but the internals use "string". + if(opts.type === "binarystring") { + opts.type = "string"; + } + + if (!opts.type) { + throw new Error("No output type specified."); + } + + utils.checkSupport(opts.type); + + // accept nodejs `process.platform` + if( + opts.platform === 'darwin' || + opts.platform === 'freebsd' || + opts.platform === 'linux' || + opts.platform === 'sunos' + ) { + opts.platform = "UNIX"; + } + if (opts.platform === 'win32') { + opts.platform = "DOS"; + } + + var comment = opts.comment || this.comment || ""; + worker = generate.generateWorker(this, opts, comment); + } catch (e) { + worker = new GenericWorker("error"); + worker.error(e); + } + return new StreamHelper(worker, opts.type || "string", opts.mimeType); + }, + /** + * Generate the complete zip file asynchronously. + * @see generateInternalStream + */ + generateAsync: function(options, onUpdate) { + return this.generateInternalStream(options).accumulate(onUpdate); + }, + /** + * Generate the complete zip file asynchronously. + * @see generateInternalStream + */ + generateNodeStream: function(options, onUpdate) { + options = options || {}; + if (!options.type) { + options.type = "nodebuffer"; + } + return this.generateInternalStream(options).toNodejsStream(onUpdate); + } +}; +module.exports = out; + +},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(require,module,exports){ +/* + * This file is used by module bundlers (browserify/webpack/etc) when + * including a stream implementation. We use "readable-stream" to get a + * consistent behavior between nodejs versions but bundlers often have a shim + * for "stream". Using this shim greatly improve the compatibility and greatly + * reduce the final size of the bundle (only one stream implementation, not + * two). + */ +module.exports = require("stream"); + +},{"stream":undefined}],17:[function(require,module,exports){ +'use strict'; +var DataReader = require('./DataReader'); +var utils = require('../utils'); + +function ArrayReader(data) { + DataReader.call(this, data); + for(var i = 0; i < this.data.length; i++) { + data[i] = data[i] & 0xFF; + } +} +utils.inherits(ArrayReader, DataReader); +/** + * @see DataReader.byteAt + */ +ArrayReader.prototype.byteAt = function(i) { + return this.data[this.zero + i]; +}; +/** + * @see DataReader.lastIndexOfSignature + */ +ArrayReader.prototype.lastIndexOfSignature = function(sig) { + var sig0 = sig.charCodeAt(0), + sig1 = sig.charCodeAt(1), + sig2 = sig.charCodeAt(2), + sig3 = sig.charCodeAt(3); + for (var i = this.length - 4; i >= 0; --i) { + if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) { + return i - this.zero; + } + } + + return -1; +}; +/** + * @see DataReader.readAndCheckSignature + */ +ArrayReader.prototype.readAndCheckSignature = function (sig) { + var sig0 = sig.charCodeAt(0), + sig1 = sig.charCodeAt(1), + sig2 = sig.charCodeAt(2), + sig3 = sig.charCodeAt(3), + data = this.readData(4); + return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3]; +}; +/** + * @see DataReader.readData + */ +ArrayReader.prototype.readData = function(size) { + this.checkOffset(size); + if(size === 0) { + return []; + } + var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = ArrayReader; + +},{"../utils":32,"./DataReader":18}],18:[function(require,module,exports){ +'use strict'; +var utils = require('../utils'); + +function DataReader(data) { + this.data = data; // type : see implementation + this.length = data.length; + this.index = 0; + this.zero = 0; +} +DataReader.prototype = { + /** + * Check that the offset will not go too far. + * @param {string} offset the additional offset to check. + * @throws {Error} an Error if the offset is out of bounds. + */ + checkOffset: function(offset) { + this.checkIndex(this.index + offset); + }, + /** + * Check that the specified index will not be too far. + * @param {string} newIndex the index to check. + * @throws {Error} an Error if the index is out of bounds. + */ + checkIndex: function(newIndex) { + if (this.length < this.zero + newIndex || newIndex < 0) { + throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?"); + } + }, + /** + * Change the index. + * @param {number} newIndex The new index. + * @throws {Error} if the new index is out of the data. + */ + setIndex: function(newIndex) { + this.checkIndex(newIndex); + this.index = newIndex; + }, + /** + * Skip the next n bytes. + * @param {number} n the number of bytes to skip. + * @throws {Error} if the new index is out of the data. + */ + skip: function(n) { + this.setIndex(this.index + n); + }, + /** + * Get the byte at the specified index. + * @param {number} i the index to use. + * @return {number} a byte. + */ + byteAt: function(i) { + // see implementations + }, + /** + * Get the next number with a given byte size. + * @param {number} size the number of bytes to read. + * @return {number} the corresponding number. + */ + readInt: function(size) { + var result = 0, + i; + this.checkOffset(size); + for (i = this.index + size - 1; i >= this.index; i--) { + result = (result << 8) + this.byteAt(i); + } + this.index += size; + return result; + }, + /** + * Get the next string with a given byte size. + * @param {number} size the number of bytes to read. + * @return {string} the corresponding string. + */ + readString: function(size) { + return utils.transformTo("string", this.readData(size)); + }, + /** + * Get raw data without conversion, bytes. + * @param {number} size the number of bytes to read. + * @return {Object} the raw data, implementation specific. + */ + readData: function(size) { + // see implementations + }, + /** + * Find the last occurrence of a zip signature (4 bytes). + * @param {string} sig the signature to find. + * @return {number} the index of the last occurrence, -1 if not found. + */ + lastIndexOfSignature: function(sig) { + // see implementations + }, + /** + * Read the signature (4 bytes) at the current position and compare it with sig. + * @param {string} sig the expected signature + * @return {boolean} true if the signature matches, false otherwise. + */ + readAndCheckSignature: function(sig) { + // see implementations + }, + /** + * Get the next date. + * @return {Date} the date. + */ + readDate: function() { + var dostime = this.readInt(4); + return new Date(Date.UTC( + ((dostime >> 25) & 0x7f) + 1980, // year + ((dostime >> 21) & 0x0f) - 1, // month + (dostime >> 16) & 0x1f, // day + (dostime >> 11) & 0x1f, // hour + (dostime >> 5) & 0x3f, // minute + (dostime & 0x1f) << 1)); // second + } +}; +module.exports = DataReader; + +},{"../utils":32}],19:[function(require,module,exports){ +'use strict'; +var Uint8ArrayReader = require('./Uint8ArrayReader'); +var utils = require('../utils'); + +function NodeBufferReader(data) { + Uint8ArrayReader.call(this, data); +} +utils.inherits(NodeBufferReader, Uint8ArrayReader); + +/** + * @see DataReader.readData + */ +NodeBufferReader.prototype.readData = function(size) { + this.checkOffset(size); + var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = NodeBufferReader; + +},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(require,module,exports){ +'use strict'; +var DataReader = require('./DataReader'); +var utils = require('../utils'); + +function StringReader(data) { + DataReader.call(this, data); +} +utils.inherits(StringReader, DataReader); +/** + * @see DataReader.byteAt + */ +StringReader.prototype.byteAt = function(i) { + return this.data.charCodeAt(this.zero + i); +}; +/** + * @see DataReader.lastIndexOfSignature + */ +StringReader.prototype.lastIndexOfSignature = function(sig) { + return this.data.lastIndexOf(sig) - this.zero; +}; +/** + * @see DataReader.readAndCheckSignature + */ +StringReader.prototype.readAndCheckSignature = function (sig) { + var data = this.readData(4); + return sig === data; +}; +/** + * @see DataReader.readData + */ +StringReader.prototype.readData = function(size) { + this.checkOffset(size); + // this will work because the constructor applied the "& 0xff" mask. + var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = StringReader; + +},{"../utils":32,"./DataReader":18}],21:[function(require,module,exports){ +'use strict'; +var ArrayReader = require('./ArrayReader'); +var utils = require('../utils'); + +function Uint8ArrayReader(data) { + ArrayReader.call(this, data); +} +utils.inherits(Uint8ArrayReader, ArrayReader); +/** + * @see DataReader.readData + */ +Uint8ArrayReader.prototype.readData = function(size) { + this.checkOffset(size); + if(size === 0) { + // in IE10, when using subarray(idx, idx), we get the array [0x00] instead of []. + return new Uint8Array(0); + } + var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); + this.index += size; + return result; +}; +module.exports = Uint8ArrayReader; + +},{"../utils":32,"./ArrayReader":17}],22:[function(require,module,exports){ +'use strict'; + +var utils = require('../utils'); +var support = require('../support'); +var ArrayReader = require('./ArrayReader'); +var StringReader = require('./StringReader'); +var NodeBufferReader = require('./NodeBufferReader'); +var Uint8ArrayReader = require('./Uint8ArrayReader'); + +/** + * Create a reader adapted to the data. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read. + * @return {DataReader} the data reader. + */ +module.exports = function (data) { + var type = utils.getTypeOf(data); + utils.checkSupport(type); + if (type === "string" && !support.uint8array) { + return new StringReader(data); + } + if (type === "nodebuffer") { + return new NodeBufferReader(data); + } + if (support.uint8array) { + return new Uint8ArrayReader(utils.transformTo("uint8array", data)); + } + return new ArrayReader(utils.transformTo("array", data)); +}; + +},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(require,module,exports){ +'use strict'; +exports.LOCAL_FILE_HEADER = "PK\x03\x04"; +exports.CENTRAL_FILE_HEADER = "PK\x01\x02"; +exports.CENTRAL_DIRECTORY_END = "PK\x05\x06"; +exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x06\x07"; +exports.ZIP64_CENTRAL_DIRECTORY_END = "PK\x06\x06"; +exports.DATA_DESCRIPTOR = "PK\x07\x08"; + +},{}],24:[function(require,module,exports){ +'use strict'; + +var GenericWorker = require('./GenericWorker'); +var utils = require('../utils'); + +/** + * A worker which convert chunks to a specified type. + * @constructor + * @param {String} destType the destination type. + */ +function ConvertWorker(destType) { + GenericWorker.call(this, "ConvertWorker to " + destType); + this.destType = destType; +} +utils.inherits(ConvertWorker, GenericWorker); + +/** + * @see GenericWorker.processChunk + */ +ConvertWorker.prototype.processChunk = function (chunk) { + this.push({ + data : utils.transformTo(this.destType, chunk.data), + meta : chunk.meta + }); +}; +module.exports = ConvertWorker; + +},{"../utils":32,"./GenericWorker":28}],25:[function(require,module,exports){ +'use strict'; + +var GenericWorker = require('./GenericWorker'); +var crc32 = require('../crc32'); +var utils = require('../utils'); + +/** + * A worker which calculate the crc32 of the data flowing through. + * @constructor + */ +function Crc32Probe() { + GenericWorker.call(this, "Crc32Probe"); + this.withStreamInfo("crc32", 0); +} +utils.inherits(Crc32Probe, GenericWorker); + +/** + * @see GenericWorker.processChunk + */ +Crc32Probe.prototype.processChunk = function (chunk) { + this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0); + this.push(chunk); +}; +module.exports = Crc32Probe; + +},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(require,module,exports){ +'use strict'; + +var utils = require('../utils'); +var GenericWorker = require('./GenericWorker'); + +/** + * A worker which calculate the total length of the data flowing through. + * @constructor + * @param {String} propName the name used to expose the length + */ +function DataLengthProbe(propName) { + GenericWorker.call(this, "DataLengthProbe for " + propName); + this.propName = propName; + this.withStreamInfo(propName, 0); +} +utils.inherits(DataLengthProbe, GenericWorker); + +/** + * @see GenericWorker.processChunk + */ +DataLengthProbe.prototype.processChunk = function (chunk) { + if(chunk) { + var length = this.streamInfo[this.propName] || 0; + this.streamInfo[this.propName] = length + chunk.data.length; + } + GenericWorker.prototype.processChunk.call(this, chunk); +}; +module.exports = DataLengthProbe; + + +},{"../utils":32,"./GenericWorker":28}],27:[function(require,module,exports){ +'use strict'; + +var utils = require('../utils'); +var GenericWorker = require('./GenericWorker'); + +// the size of the generated chunks +// TODO expose this as a public variable +var DEFAULT_BLOCK_SIZE = 16 * 1024; + +/** + * A worker that reads a content and emits chunks. + * @constructor + * @param {Promise} dataP the promise of the data to split + */ +function DataWorker(dataP) { + GenericWorker.call(this, "DataWorker"); + var self = this; + this.dataIsReady = false; + this.index = 0; + this.max = 0; + this.data = null; + this.type = ""; + + this._tickScheduled = false; + + dataP.then(function (data) { + self.dataIsReady = true; + self.data = data; + self.max = data && data.length || 0; + self.type = utils.getTypeOf(data); + if(!self.isPaused) { + self._tickAndRepeat(); + } + }, function (e) { + self.error(e); + }); +} + +utils.inherits(DataWorker, GenericWorker); + +/** + * @see GenericWorker.cleanUp + */ +DataWorker.prototype.cleanUp = function () { + GenericWorker.prototype.cleanUp.call(this); + this.data = null; +}; + +/** + * @see GenericWorker.resume + */ +DataWorker.prototype.resume = function () { + if(!GenericWorker.prototype.resume.call(this)) { + return false; + } + + if (!this._tickScheduled && this.dataIsReady) { + this._tickScheduled = true; + utils.delay(this._tickAndRepeat, [], this); + } + return true; +}; + +/** + * Trigger a tick a schedule an other call to this function. + */ +DataWorker.prototype._tickAndRepeat = function() { + this._tickScheduled = false; + if(this.isPaused || this.isFinished) { + return; + } + this._tick(); + if(!this.isFinished) { + utils.delay(this._tickAndRepeat, [], this); + this._tickScheduled = true; + } +}; + +/** + * Read and push a chunk. + */ +DataWorker.prototype._tick = function() { + + if(this.isPaused || this.isFinished) { + return false; + } + + var size = DEFAULT_BLOCK_SIZE; + var data = null, nextIndex = Math.min(this.max, this.index + size); + if (this.index >= this.max) { + // EOF + return this.end(); + } else { + switch(this.type) { + case "string": + data = this.data.substring(this.index, nextIndex); + break; + case "uint8array": + data = this.data.subarray(this.index, nextIndex); + break; + case "array": + case "nodebuffer": + data = this.data.slice(this.index, nextIndex); + break; + } + this.index = nextIndex; + return this.push({ + data : data, + meta : { + percent : this.max ? this.index / this.max * 100 : 0 + } + }); + } +}; + +module.exports = DataWorker; + +},{"../utils":32,"./GenericWorker":28}],28:[function(require,module,exports){ +'use strict'; + +/** + * A worker that does nothing but passing chunks to the next one. This is like + * a nodejs stream but with some differences. On the good side : + * - it works on IE 6-9 without any issue / polyfill + * - it weights less than the full dependencies bundled with browserify + * - it forwards errors (no need to declare an error handler EVERYWHERE) + * + * A chunk is an object with 2 attributes : `meta` and `data`. The former is an + * object containing anything (`percent` for example), see each worker for more + * details. The latter is the real data (String, Uint8Array, etc). + * + * @constructor + * @param {String} name the name of the stream (mainly used for debugging purposes) + */ +function GenericWorker(name) { + // the name of the worker + this.name = name || "default"; + // an object containing metadata about the workers chain + this.streamInfo = {}; + // an error which happened when the worker was paused + this.generatedError = null; + // an object containing metadata to be merged by this worker into the general metadata + this.extraStreamInfo = {}; + // true if the stream is paused (and should not do anything), false otherwise + this.isPaused = true; + // true if the stream is finished (and should not do anything), false otherwise + this.isFinished = false; + // true if the stream is locked to prevent further structure updates (pipe), false otherwise + this.isLocked = false; + // the event listeners + this._listeners = { + 'data':[], + 'end':[], + 'error':[] + }; + // the previous worker, if any + this.previous = null; +} + +GenericWorker.prototype = { + /** + * Push a chunk to the next workers. + * @param {Object} chunk the chunk to push + */ + push : function (chunk) { + this.emit("data", chunk); + }, + /** + * End the stream. + * @return {Boolean} true if this call ended the worker, false otherwise. + */ + end : function () { + if (this.isFinished) { + return false; + } + + this.flush(); + try { + this.emit("end"); + this.cleanUp(); + this.isFinished = true; + } catch (e) { + this.emit("error", e); + } + return true; + }, + /** + * End the stream with an error. + * @param {Error} e the error which caused the premature end. + * @return {Boolean} true if this call ended the worker with an error, false otherwise. + */ + error : function (e) { + if (this.isFinished) { + return false; + } + + if(this.isPaused) { + this.generatedError = e; + } else { + this.isFinished = true; + + this.emit("error", e); + + // in the workers chain exploded in the middle of the chain, + // the error event will go downward but we also need to notify + // workers upward that there has been an error. + if(this.previous) { + this.previous.error(e); + } + + this.cleanUp(); + } + return true; + }, + /** + * Add a callback on an event. + * @param {String} name the name of the event (data, end, error) + * @param {Function} listener the function to call when the event is triggered + * @return {GenericWorker} the current object for chainability + */ + on : function (name, listener) { + this._listeners[name].push(listener); + return this; + }, + /** + * Clean any references when a worker is ending. + */ + cleanUp : function () { + this.streamInfo = this.generatedError = this.extraStreamInfo = null; + this._listeners = []; + }, + /** + * Trigger an event. This will call registered callback with the provided arg. + * @param {String} name the name of the event (data, end, error) + * @param {Object} arg the argument to call the callback with. + */ + emit : function (name, arg) { + if (this._listeners[name]) { + for(var i = 0; i < this._listeners[name].length; i++) { + this._listeners[name][i].call(this, arg); + } + } + }, + /** + * Chain a worker with an other. + * @param {Worker} next the worker receiving events from the current one. + * @return {worker} the next worker for chainability + */ + pipe : function (next) { + return next.registerPrevious(this); + }, + /** + * Same as `pipe` in the other direction. + * Using an API with `pipe(next)` is very easy. + * Implementing the API with the point of view of the next one registering + * a source is easier, see the ZipFileWorker. + * @param {Worker} previous the previous worker, sending events to this one + * @return {Worker} the current worker for chainability + */ + registerPrevious : function (previous) { + if (this.isLocked) { + throw new Error("The stream '" + this + "' has already been used."); + } + + // sharing the streamInfo... + this.streamInfo = previous.streamInfo; + // ... and adding our own bits + this.mergeStreamInfo(); + this.previous = previous; + var self = this; + previous.on('data', function (chunk) { + self.processChunk(chunk); + }); + previous.on('end', function () { + self.end(); + }); + previous.on('error', function (e) { + self.error(e); + }); + return this; + }, + /** + * Pause the stream so it doesn't send events anymore. + * @return {Boolean} true if this call paused the worker, false otherwise. + */ + pause : function () { + if(this.isPaused || this.isFinished) { + return false; + } + this.isPaused = true; + + if(this.previous) { + this.previous.pause(); + } + return true; + }, + /** + * Resume a paused stream. + * @return {Boolean} true if this call resumed the worker, false otherwise. + */ + resume : function () { + if(!this.isPaused || this.isFinished) { + return false; + } + this.isPaused = false; + + // if true, the worker tried to resume but failed + var withError = false; + if(this.generatedError) { + this.error(this.generatedError); + withError = true; + } + if(this.previous) { + this.previous.resume(); + } + + return !withError; + }, + /** + * Flush any remaining bytes as the stream is ending. + */ + flush : function () {}, + /** + * Process a chunk. This is usually the method overridden. + * @param {Object} chunk the chunk to process. + */ + processChunk : function(chunk) { + this.push(chunk); + }, + /** + * Add a key/value to be added in the workers chain streamInfo once activated. + * @param {String} key the key to use + * @param {Object} value the associated value + * @return {Worker} the current worker for chainability + */ + withStreamInfo : function (key, value) { + this.extraStreamInfo[key] = value; + this.mergeStreamInfo(); + return this; + }, + /** + * Merge this worker's streamInfo into the chain's streamInfo. + */ + mergeStreamInfo : function () { + for(var key in this.extraStreamInfo) { + if (!this.extraStreamInfo.hasOwnProperty(key)) { + continue; + } + this.streamInfo[key] = this.extraStreamInfo[key]; + } + }, + + /** + * Lock the stream to prevent further updates on the workers chain. + * After calling this method, all calls to pipe will fail. + */ + lock: function () { + if (this.isLocked) { + throw new Error("The stream '" + this + "' has already been used."); + } + this.isLocked = true; + if (this.previous) { + this.previous.lock(); + } + }, + + /** + * + * Pretty print the workers chain. + */ + toString : function () { + var me = "Worker " + this.name; + if (this.previous) { + return this.previous + " -> " + me; + } else { + return me; + } + } +}; + +module.exports = GenericWorker; + +},{}],29:[function(require,module,exports){ +'use strict'; + +var utils = require('../utils'); +var ConvertWorker = require('./ConvertWorker'); +var GenericWorker = require('./GenericWorker'); +var base64 = require('../base64'); +var support = require("../support"); +var external = require("../external"); + +var NodejsStreamOutputAdapter = null; +if (support.nodestream) { + try { + NodejsStreamOutputAdapter = require('../nodejs/NodejsStreamOutputAdapter'); + } catch(e) {} +} + +/** + * Apply the final transformation of the data. If the user wants a Blob for + * example, it's easier to work with an U8intArray and finally do the + * ArrayBuffer/Blob conversion. + * @param {String} type the name of the final type + * @param {String|Uint8Array|Buffer} content the content to transform + * @param {String} mimeType the mime type of the content, if applicable. + * @return {String|Uint8Array|ArrayBuffer|Buffer|Blob} the content in the right format. + */ +function transformZipOutput(type, content, mimeType) { + switch(type) { + case "blob" : + return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType); + case "base64" : + return base64.encode(content); + default : + return utils.transformTo(type, content); + } +} + +/** + * Concatenate an array of data of the given type. + * @param {String} type the type of the data in the given array. + * @param {Array} dataArray the array containing the data chunks to concatenate + * @return {String|Uint8Array|Buffer} the concatenated data + * @throws Error if the asked type is unsupported + */ +function concat (type, dataArray) { + var i, index = 0, res = null, totalLength = 0; + for(i = 0; i < dataArray.length; i++) { + totalLength += dataArray[i].length; + } + switch(type) { + case "string": + return dataArray.join(""); + case "array": + return Array.prototype.concat.apply([], dataArray); + case "uint8array": + res = new Uint8Array(totalLength); + for(i = 0; i < dataArray.length; i++) { + res.set(dataArray[i], index); + index += dataArray[i].length; + } + return res; + case "nodebuffer": + return Buffer.concat(dataArray); + default: + throw new Error("concat : unsupported type '" + type + "'"); + } +} + +/** + * Listen a StreamHelper, accumulate its content and concatenate it into a + * complete block. + * @param {StreamHelper} helper the helper to use. + * @param {Function} updateCallback a callback called on each update. Called + * with one arg : + * - the metadata linked to the update received. + * @return Promise the promise for the accumulation. + */ +function accumulate(helper, updateCallback) { + return new external.Promise(function (resolve, reject){ + var dataArray = []; + var chunkType = helper._internalType, + resultType = helper._outputType, + mimeType = helper._mimeType; + helper + .on('data', function (data, meta) { + dataArray.push(data); + if(updateCallback) { + updateCallback(meta); + } + }) + .on('error', function(err) { + dataArray = []; + reject(err); + }) + .on('end', function (){ + try { + var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); + resolve(result); + } catch (e) { + reject(e); + } + dataArray = []; + }) + .resume(); + }); +} + +/** + * An helper to easily use workers outside of JSZip. + * @constructor + * @param {Worker} worker the worker to wrap + * @param {String} outputType the type of data expected by the use + * @param {String} mimeType the mime type of the content, if applicable. + */ +function StreamHelper(worker, outputType, mimeType) { + var internalType = outputType; + switch(outputType) { + case "blob": + case "arraybuffer": + internalType = "uint8array"; + break; + case "base64": + internalType = "string"; + break; + } + + try { + // the type used internally + this._internalType = internalType; + // the type used to output results + this._outputType = outputType; + // the mime type + this._mimeType = mimeType; + utils.checkSupport(internalType); + this._worker = worker.pipe(new ConvertWorker(internalType)); + // the last workers can be rewired without issues but we need to + // prevent any updates on previous workers. + worker.lock(); + } catch(e) { + this._worker = new GenericWorker("error"); + this._worker.error(e); + } +} + +StreamHelper.prototype = { + /** + * Listen a StreamHelper, accumulate its content and concatenate it into a + * complete block. + * @param {Function} updateCb the update callback. + * @return Promise the promise for the accumulation. + */ + accumulate : function (updateCb) { + return accumulate(this, updateCb); + }, + /** + * Add a listener on an event triggered on a stream. + * @param {String} evt the name of the event + * @param {Function} fn the listener + * @return {StreamHelper} the current helper. + */ + on : function (evt, fn) { + var self = this; + + if(evt === "data") { + this._worker.on(evt, function (chunk) { + fn.call(self, chunk.data, chunk.meta); + }); + } else { + this._worker.on(evt, function () { + utils.delay(fn, arguments, self); + }); + } + return this; + }, + /** + * Resume the flow of chunks. + * @return {StreamHelper} the current helper. + */ + resume : function () { + utils.delay(this._worker.resume, [], this._worker); + return this; + }, + /** + * Pause the flow of chunks. + * @return {StreamHelper} the current helper. + */ + pause : function () { + this._worker.pause(); + return this; + }, + /** + * Return a nodejs stream for this helper. + * @param {Function} updateCb the update callback. + * @return {NodejsStreamOutputAdapter} the nodejs stream. + */ + toNodejsStream : function (updateCb) { + utils.checkSupport("nodestream"); + if (this._outputType !== "nodebuffer") { + // an object stream containing blob/arraybuffer/uint8array/string + // is strange and I don't know if it would be useful. + // I you find this comment and have a good usecase, please open a + // bug report ! + throw new Error(this._outputType + " is not supported by this method"); + } + + return new NodejsStreamOutputAdapter(this, { + objectMode : this._outputType !== "nodebuffer" + }, updateCb); + } +}; + + +module.exports = StreamHelper; + +},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(require,module,exports){ +'use strict'; + +exports.base64 = true; +exports.array = true; +exports.string = true; +exports.arraybuffer = typeof ArrayBuffer !== "undefined" && typeof Uint8Array !== "undefined"; +exports.nodebuffer = typeof Buffer !== "undefined"; +// contains true if JSZip can read/generate Uint8Array, false otherwise. +exports.uint8array = typeof Uint8Array !== "undefined"; + +if (typeof ArrayBuffer === "undefined") { + exports.blob = false; +} +else { + var buffer = new ArrayBuffer(0); + try { + exports.blob = new Blob([buffer], { + type: "application/zip" + }).size === 0; + } + catch (e) { + try { + var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; + var builder = new Builder(); + builder.append(buffer); + exports.blob = builder.getBlob('application/zip').size === 0; + } + catch (e) { + exports.blob = false; + } + } +} + +try { + exports.nodestream = !!require('readable-stream').Readable; +} catch(e) { + exports.nodestream = false; +} + +},{"readable-stream":16}],31:[function(require,module,exports){ +'use strict'; + +var utils = require('./utils'); +var support = require('./support'); +var nodejsUtils = require('./nodejsUtils'); +var GenericWorker = require('./stream/GenericWorker'); + +/** + * The following functions come from pako, from pako/lib/utils/strings + * released under the MIT license, see pako https://github.com/nodeca/pako/ + */ + +// Table with utf8 lengths (calculated by first byte of sequence) +// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, +// because max possible codepoint is 0x10ffff +var _utf8len = new Array(256); +for (var i=0; i<256; i++) { + _utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1); +} +_utf8len[254]=_utf8len[254]=1; // Invalid sequence start + +// convert string to array (typed, when possible) +var string2buf = function (str) { + var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; + + // count binary size + for (m_pos = 0; m_pos < str_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; + } + + // allocate buffer + if (support.uint8array) { + buf = new Uint8Array(buf_len); + } else { + buf = new Array(buf_len); + } + + // convert + for (i=0, m_pos = 0; i < buf_len; m_pos++) { + c = str.charCodeAt(m_pos); + if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { + c2 = str.charCodeAt(m_pos+1); + if ((c2 & 0xfc00) === 0xdc00) { + c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); + m_pos++; + } + } + if (c < 0x80) { + /* one byte */ + buf[i++] = c; + } else if (c < 0x800) { + /* two bytes */ + buf[i++] = 0xC0 | (c >>> 6); + buf[i++] = 0x80 | (c & 0x3f); + } else if (c < 0x10000) { + /* three bytes */ + buf[i++] = 0xE0 | (c >>> 12); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } else { + /* four bytes */ + buf[i++] = 0xf0 | (c >>> 18); + buf[i++] = 0x80 | (c >>> 12 & 0x3f); + buf[i++] = 0x80 | (c >>> 6 & 0x3f); + buf[i++] = 0x80 | (c & 0x3f); + } + } + + return buf; +}; + +// Calculate max possible position in utf8 buffer, +// that will not break sequence. If that's not possible +// - (very small limits) return max size as is. +// +// buf[] - utf8 bytes array +// max - length limit (mandatory); +var utf8border = function(buf, max) { + var pos; + + max = max || buf.length; + if (max > buf.length) { max = buf.length; } + + // go back from last position, until start of sequence found + pos = max-1; + while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } + + // Fuckup - very small and broken sequence, + // return max, because we should return something anyway. + if (pos < 0) { return max; } + + // If we came to start of buffer - that means vuffer is too small, + // return max too. + if (pos === 0) { return max; } + + return (pos + _utf8len[buf[pos]] > max) ? pos : max; +}; + +// convert array to string +var buf2string = function (buf) { + var str, i, out, c, c_len; + var len = buf.length; + + // Reserve max possible length (2 words per char) + // NB: by unknown reasons, Array is significantly faster for + // String.fromCharCode.apply than Uint16Array. + var utf16buf = new Array(len*2); + + for (out=0, i=0; i 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } + + // apply mask on first byte + c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; + // join the rest + while (c_len > 1 && i < len) { + c = (c << 6) | (buf[i++] & 0x3f); + c_len--; + } + + // terminated by end of string? + if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } + + if (c < 0x10000) { + utf16buf[out++] = c; + } else { + c -= 0x10000; + utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); + utf16buf[out++] = 0xdc00 | (c & 0x3ff); + } + } + + // shrinkBuf(utf16buf, out) + if (utf16buf.length !== out) { + if(utf16buf.subarray) { + utf16buf = utf16buf.subarray(0, out); + } else { + utf16buf.length = out; + } + } + + // return String.fromCharCode.apply(null, utf16buf); + return utils.applyFromCharCode(utf16buf); +}; + + +// That's all for the pako functions. + + +/** + * Transform a javascript string into an array (typed if possible) of bytes, + * UTF-8 encoded. + * @param {String} str the string to encode + * @return {Array|Uint8Array|Buffer} the UTF-8 encoded string. + */ +exports.utf8encode = function utf8encode(str) { + if (support.nodebuffer) { + return nodejsUtils.newBufferFrom(str, "utf-8"); + } + + return string2buf(str); +}; + + +/** + * Transform a bytes array (or a representation) representing an UTF-8 encoded + * string into a javascript string. + * @param {Array|Uint8Array|Buffer} buf the data de decode + * @return {String} the decoded string. + */ +exports.utf8decode = function utf8decode(buf) { + if (support.nodebuffer) { + return utils.transformTo("nodebuffer", buf).toString("utf-8"); + } + + buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf); + + return buf2string(buf); +}; + +/** + * A worker to decode utf8 encoded binary chunks into string chunks. + * @constructor + */ +function Utf8DecodeWorker() { + GenericWorker.call(this, "utf-8 decode"); + // the last bytes if a chunk didn't end with a complete codepoint. + this.leftOver = null; +} +utils.inherits(Utf8DecodeWorker, GenericWorker); + +/** + * @see GenericWorker.processChunk + */ +Utf8DecodeWorker.prototype.processChunk = function (chunk) { + + var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data); + + // 1st step, re-use what's left of the previous chunk + if (this.leftOver && this.leftOver.length) { + if(support.uint8array) { + var previousData = data; + data = new Uint8Array(previousData.length + this.leftOver.length); + data.set(this.leftOver, 0); + data.set(previousData, this.leftOver.length); + } else { + data = this.leftOver.concat(data); + } + this.leftOver = null; + } + + var nextBoundary = utf8border(data); + var usableData = data; + if (nextBoundary !== data.length) { + if (support.uint8array) { + usableData = data.subarray(0, nextBoundary); + this.leftOver = data.subarray(nextBoundary, data.length); + } else { + usableData = data.slice(0, nextBoundary); + this.leftOver = data.slice(nextBoundary, data.length); + } + } + + this.push({ + data : exports.utf8decode(usableData), + meta : chunk.meta + }); +}; + +/** + * @see GenericWorker.flush + */ +Utf8DecodeWorker.prototype.flush = function () { + if(this.leftOver && this.leftOver.length) { + this.push({ + data : exports.utf8decode(this.leftOver), + meta : {} + }); + this.leftOver = null; + } +}; +exports.Utf8DecodeWorker = Utf8DecodeWorker; + +/** + * A worker to endcode string chunks into utf8 encoded binary chunks. + * @constructor + */ +function Utf8EncodeWorker() { + GenericWorker.call(this, "utf-8 encode"); +} +utils.inherits(Utf8EncodeWorker, GenericWorker); + +/** + * @see GenericWorker.processChunk + */ +Utf8EncodeWorker.prototype.processChunk = function (chunk) { + this.push({ + data : exports.utf8encode(chunk.data), + meta : chunk.meta + }); +}; +exports.Utf8EncodeWorker = Utf8EncodeWorker; + +},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(require,module,exports){ +'use strict'; + +var support = require('./support'); +var base64 = require('./base64'); +var nodejsUtils = require('./nodejsUtils'); +var setImmediate = require('set-immediate-shim'); +var external = require("./external"); + + +/** + * Convert a string that pass as a "binary string": it should represent a byte + * array but may have > 255 char codes. Be sure to take only the first byte + * and returns the byte array. + * @param {String} str the string to transform. + * @return {Array|Uint8Array} the string in a binary format. + */ +function string2binary(str) { + var result = null; + if (support.uint8array) { + result = new Uint8Array(str.length); + } else { + result = new Array(str.length); + } + return stringToArrayLike(str, result); +} + +/** + * Create a new blob with the given content and the given type. + * @param {String|ArrayBuffer} part the content to put in the blob. DO NOT use + * an Uint8Array because the stock browser of android 4 won't accept it (it + * will be silently converted to a string, "[object Uint8Array]"). + * + * Use only ONE part to build the blob to avoid a memory leak in IE11 / Edge: + * when a large amount of Array is used to create the Blob, the amount of + * memory consumed is nearly 100 times the original data amount. + * + * @param {String} type the mime type of the blob. + * @return {Blob} the created blob. + */ +exports.newBlob = function(part, type) { + exports.checkSupport("blob"); + + try { + // Blob constructor + return new Blob([part], { + type: type + }); + } + catch (e) { + + try { + // deprecated, browser only, old way + var Builder = self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder; + var builder = new Builder(); + builder.append(part); + return builder.getBlob(type); + } + catch (e) { + + // well, fuck ?! + throw new Error("Bug : can't construct the Blob."); + } + } + + +}; +/** + * The identity function. + * @param {Object} input the input. + * @return {Object} the same input. + */ +function identity(input) { + return input; +} + +/** + * Fill in an array with a string. + * @param {String} str the string to use. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to fill in (will be mutated). + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated array. + */ +function stringToArrayLike(str, array) { + for (var i = 0; i < str.length; ++i) { + array[i] = str.charCodeAt(i) & 0xFF; + } + return array; +} + +/** + * An helper for the function arrayLikeToString. + * This contains static information and functions that + * can be optimized by the browser JIT compiler. + */ +var arrayToStringHelper = { + /** + * Transform an array of int into a string, chunk by chunk. + * See the performances notes on arrayLikeToString. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. + * @param {String} type the type of the array. + * @param {Integer} chunk the chunk size. + * @return {String} the resulting string. + * @throws Error if the chunk is too big for the stack. + */ + stringifyByChunk: function(array, type, chunk) { + var result = [], k = 0, len = array.length; + // shortcut + if (len <= chunk) { + return String.fromCharCode.apply(null, array); + } + while (k < len) { + if (type === "array" || type === "nodebuffer") { + result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); + } + else { + result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); + } + k += chunk; + } + return result.join(""); + }, + /** + * Call String.fromCharCode on every item in the array. + * This is the naive implementation, which generate A LOT of intermediate string. + * This should be used when everything else fail. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. + * @return {String} the result. + */ + stringifyByChar: function(array){ + var resultStr = ""; + for(var i = 0; i < array.length; i++) { + resultStr += String.fromCharCode(array[i]); + } + return resultStr; + }, + applyCanBeUsed : { + /** + * true if the browser accepts to use String.fromCharCode on Uint8Array + */ + uint8array : (function () { + try { + return support.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1; + } catch (e) { + return false; + } + })(), + /** + * true if the browser accepts to use String.fromCharCode on nodejs Buffer. + */ + nodebuffer : (function () { + try { + return support.nodebuffer && String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length === 1; + } catch (e) { + return false; + } + })() + } +}; + +/** + * Transform an array-like object to a string. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} array the array to transform. + * @return {String} the result. + */ +function arrayLikeToString(array) { + // Performances notes : + // -------------------- + // String.fromCharCode.apply(null, array) is the fastest, see + // see http://jsperf.com/converting-a-uint8array-to-a-string/2 + // but the stack is limited (and we can get huge arrays !). + // + // result += String.fromCharCode(array[i]); generate too many strings ! + // + // This code is inspired by http://jsperf.com/arraybuffer-to-string-apply-performance/2 + // TODO : we now have workers that split the work. Do we still need that ? + var chunk = 65536, + type = exports.getTypeOf(array), + canUseApply = true; + if (type === "uint8array") { + canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array; + } else if (type === "nodebuffer") { + canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer; + } + + if (canUseApply) { + while (chunk > 1) { + try { + return arrayToStringHelper.stringifyByChunk(array, type, chunk); + } catch (e) { + chunk = Math.floor(chunk / 2); + } + } + } + + // no apply or chunk error : slow and painful algorithm + // default browser on android 4.* + return arrayToStringHelper.stringifyByChar(array); +} + +exports.applyFromCharCode = arrayLikeToString; + + +/** + * Copy the data from an array-like to an other array-like. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayFrom the origin array. + * @param {Array|ArrayBuffer|Uint8Array|Buffer} arrayTo the destination array which will be mutated. + * @return {Array|ArrayBuffer|Uint8Array|Buffer} the updated destination array. + */ +function arrayLikeToArrayLike(arrayFrom, arrayTo) { + for (var i = 0; i < arrayFrom.length; i++) { + arrayTo[i] = arrayFrom[i]; + } + return arrayTo; +} + +// a matrix containing functions to transform everything into everything. +var transform = {}; + +// string to ? +transform["string"] = { + "string": identity, + "array": function(input) { + return stringToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["string"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return stringToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": function(input) { + return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length)); + } +}; + +// array to ? +transform["array"] = { + "string": arrayLikeToString, + "array": identity, + "arraybuffer": function(input) { + return (new Uint8Array(input)).buffer; + }, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodejsUtils.newBufferFrom(input); + } +}; + +// arraybuffer to ? +transform["arraybuffer"] = { + "string": function(input) { + return arrayLikeToString(new Uint8Array(input)); + }, + "array": function(input) { + return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); + }, + "arraybuffer": identity, + "uint8array": function(input) { + return new Uint8Array(input); + }, + "nodebuffer": function(input) { + return nodejsUtils.newBufferFrom(new Uint8Array(input)); + } +}; + +// uint8array to ? +transform["uint8array"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return input.buffer; + }, + "uint8array": identity, + "nodebuffer": function(input) { + return nodejsUtils.newBufferFrom(input); + } +}; + +// nodebuffer to ? +transform["nodebuffer"] = { + "string": arrayLikeToString, + "array": function(input) { + return arrayLikeToArrayLike(input, new Array(input.length)); + }, + "arraybuffer": function(input) { + return transform["nodebuffer"]["uint8array"](input).buffer; + }, + "uint8array": function(input) { + return arrayLikeToArrayLike(input, new Uint8Array(input.length)); + }, + "nodebuffer": identity +}; + +/** + * Transform an input into any type. + * The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. + * If no output type is specified, the unmodified input will be returned. + * @param {String} outputType the output type. + * @param {String|Array|ArrayBuffer|Uint8Array|Buffer} input the input to convert. + * @throws {Error} an Error if the browser doesn't support the requested output type. + */ +exports.transformTo = function(outputType, input) { + if (!input) { + // undefined, null, etc + // an empty string won't harm. + input = ""; + } + if (!outputType) { + return input; + } + exports.checkSupport(outputType); + var inputType = exports.getTypeOf(input); + var result = transform[inputType][outputType](input); + return result; +}; + +/** + * Return the type of the input. + * The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer. + * @param {Object} input the input to identify. + * @return {String} the (lowercase) type of the input. + */ +exports.getTypeOf = function(input) { + if (typeof input === "string") { + return "string"; + } + if (Object.prototype.toString.call(input) === "[object Array]") { + return "array"; + } + if (support.nodebuffer && nodejsUtils.isBuffer(input)) { + return "nodebuffer"; + } + if (support.uint8array && input instanceof Uint8Array) { + return "uint8array"; + } + if (support.arraybuffer && input instanceof ArrayBuffer) { + return "arraybuffer"; + } +}; + +/** + * Throw an exception if the type is not supported. + * @param {String} type the type to check. + * @throws {Error} an Error if the browser doesn't support the requested type. + */ +exports.checkSupport = function(type) { + var supported = support[type.toLowerCase()]; + if (!supported) { + throw new Error(type + " is not supported by this platform"); + } +}; + +exports.MAX_VALUE_16BITS = 65535; +exports.MAX_VALUE_32BITS = -1; // well, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" is parsed as -1 + +/** + * Prettify a string read as binary. + * @param {string} str the string to prettify. + * @return {string} a pretty string. + */ +exports.pretty = function(str) { + var res = '', + code, i; + for (i = 0; i < (str || "").length; i++) { + code = str.charCodeAt(i); + res += '\\x' + (code < 16 ? "0" : "") + code.toString(16).toUpperCase(); + } + return res; +}; + +/** + * Defer the call of a function. + * @param {Function} callback the function to call asynchronously. + * @param {Array} args the arguments to give to the callback. + */ +exports.delay = function(callback, args, self) { + setImmediate(function () { + callback.apply(self || null, args || []); + }); +}; + +/** + * Extends a prototype with an other, without calling a constructor with + * side effects. Inspired by nodejs' `utils.inherits` + * @param {Function} ctor the constructor to augment + * @param {Function} superCtor the parent constructor to use + */ +exports.inherits = function (ctor, superCtor) { + var Obj = function() {}; + Obj.prototype = superCtor.prototype; + ctor.prototype = new Obj(); +}; + +/** + * Merge the objects passed as parameters into a new one. + * @private + * @param {...Object} var_args All objects to merge. + * @return {Object} a new object with the data of the others. + */ +exports.extend = function() { + var result = {}, i, attr; + for (i = 0; i < arguments.length; i++) { // arguments is not enumerable in some browsers + for (attr in arguments[i]) { + if (arguments[i].hasOwnProperty(attr) && typeof result[attr] === "undefined") { + result[attr] = arguments[i][attr]; + } + } + } + return result; +}; + +/** + * Transform arbitrary content into a Promise. + * @param {String} name a name for the content being processed. + * @param {Object} inputData the content to process. + * @param {Boolean} isBinary true if the content is not an unicode string + * @param {Boolean} isOptimizedBinaryString true if the string content only has one byte per character. + * @param {Boolean} isBase64 true if the string content is encoded with base64. + * @return {Promise} a promise in a format usable by JSZip. + */ +exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) { + + // if inputData is already a promise, this flatten it. + var promise = external.Promise.resolve(inputData).then(function(data) { + + + var isBlob = support.blob && (data instanceof Blob || ['[object File]', '[object Blob]'].indexOf(Object.prototype.toString.call(data)) !== -1); + + if (isBlob && typeof FileReader !== "undefined") { + return new external.Promise(function (resolve, reject) { + var reader = new FileReader(); + + reader.onload = function(e) { + resolve(e.target.result); + }; + reader.onerror = function(e) { + reject(e.target.error); + }; + reader.readAsArrayBuffer(data); + }); + } else { + return data; + } + }); + + return promise.then(function(data) { + var dataType = exports.getTypeOf(data); + + if (!dataType) { + return external.Promise.reject( + new Error("Can't read the data of '" + name + "'. Is it " + + "in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?") + ); + } + // special case : it's way easier to work with Uint8Array than with ArrayBuffer + if (dataType === "arraybuffer") { + data = exports.transformTo("uint8array", data); + } else if (dataType === "string") { + if (isBase64) { + data = base64.decode(data); + } + else if (isBinary) { + // optimizedBinaryString === true means that the file has already been filtered with a 0xFF mask + if (isOptimizedBinaryString !== true) { + // this is a string, not in a base64 format. + // Be sure that this is a correct "binary string" + data = string2binary(data); + } + } + } + return data; + }); +}; + +},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(require,module,exports){ +'use strict'; +var readerFor = require('./reader/readerFor'); +var utils = require('./utils'); +var sig = require('./signature'); +var ZipEntry = require('./zipEntry'); +var utf8 = require('./utf8'); +var support = require('./support'); +// class ZipEntries {{{ +/** + * All the entries in the zip file. + * @constructor + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntries(loadOptions) { + this.files = []; + this.loadOptions = loadOptions; +} +ZipEntries.prototype = { + /** + * Check that the reader is on the specified signature. + * @param {string} expectedSignature the expected signature. + * @throws {Error} if it is an other signature. + */ + checkSignature: function(expectedSignature) { + if (!this.reader.readAndCheckSignature(expectedSignature)) { + this.reader.index -= 4; + var signature = this.reader.readString(4); + throw new Error("Corrupted zip or bug: unexpected signature " + "(" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")"); + } + }, + /** + * Check if the given signature is at the given index. + * @param {number} askedIndex the index to check. + * @param {string} expectedSignature the signature to expect. + * @return {boolean} true if the signature is here, false otherwise. + */ + isSignature: function(askedIndex, expectedSignature) { + var currentIndex = this.reader.index; + this.reader.setIndex(askedIndex); + var signature = this.reader.readString(4); + var result = signature === expectedSignature; + this.reader.setIndex(currentIndex); + return result; + }, + /** + * Read the end of the central directory. + */ + readBlockEndOfCentral: function() { + this.diskNumber = this.reader.readInt(2); + this.diskWithCentralDirStart = this.reader.readInt(2); + this.centralDirRecordsOnThisDisk = this.reader.readInt(2); + this.centralDirRecords = this.reader.readInt(2); + this.centralDirSize = this.reader.readInt(4); + this.centralDirOffset = this.reader.readInt(4); + + this.zipCommentLength = this.reader.readInt(2); + // warning : the encoding depends of the system locale + // On a linux machine with LANG=en_US.utf8, this field is utf8 encoded. + // On a windows machine, this field is encoded with the localized windows code page. + var zipComment = this.reader.readData(this.zipCommentLength); + var decodeParamType = support.uint8array ? "uint8array" : "array"; + // To get consistent behavior with the generation part, we will assume that + // this is utf8 encoded unless specified otherwise. + var decodeContent = utils.transformTo(decodeParamType, zipComment); + this.zipComment = this.loadOptions.decodeFileName(decodeContent); + }, + /** + * Read the end of the Zip 64 central directory. + * Not merged with the method readEndOfCentral : + * The end of central can coexist with its Zip64 brother, + * I don't want to read the wrong number of bytes ! + */ + readBlockZip64EndOfCentral: function() { + this.zip64EndOfCentralSize = this.reader.readInt(8); + this.reader.skip(4); + // this.versionMadeBy = this.reader.readString(2); + // this.versionNeeded = this.reader.readInt(2); + this.diskNumber = this.reader.readInt(4); + this.diskWithCentralDirStart = this.reader.readInt(4); + this.centralDirRecordsOnThisDisk = this.reader.readInt(8); + this.centralDirRecords = this.reader.readInt(8); + this.centralDirSize = this.reader.readInt(8); + this.centralDirOffset = this.reader.readInt(8); + + this.zip64ExtensibleData = {}; + var extraDataSize = this.zip64EndOfCentralSize - 44, + index = 0, + extraFieldId, + extraFieldLength, + extraFieldValue; + while (index < extraDataSize) { + extraFieldId = this.reader.readInt(2); + extraFieldLength = this.reader.readInt(4); + extraFieldValue = this.reader.readData(extraFieldLength); + this.zip64ExtensibleData[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + }, + /** + * Read the end of the Zip 64 central directory locator. + */ + readBlockZip64EndOfCentralLocator: function() { + this.diskWithZip64CentralDirStart = this.reader.readInt(4); + this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8); + this.disksCount = this.reader.readInt(4); + if (this.disksCount > 1) { + throw new Error("Multi-volumes zip are not supported"); + } + }, + /** + * Read the local files, based on the offset read in the central part. + */ + readLocalFiles: function() { + var i, file; + for (i = 0; i < this.files.length; i++) { + file = this.files[i]; + this.reader.setIndex(file.localHeaderOffset); + this.checkSignature(sig.LOCAL_FILE_HEADER); + file.readLocalPart(this.reader); + file.handleUTF8(); + file.processAttributes(); + } + }, + /** + * Read the central directory. + */ + readCentralDir: function() { + var file; + + this.reader.setIndex(this.centralDirOffset); + while (this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER)) { + file = new ZipEntry({ + zip64: this.zip64 + }, this.loadOptions); + file.readCentralPart(this.reader); + this.files.push(file); + } + + if (this.centralDirRecords !== this.files.length) { + if (this.centralDirRecords !== 0 && this.files.length === 0) { + // We expected some records but couldn't find ANY. + // This is really suspicious, as if something went wrong. + throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length); + } else { + // We found some records but not all. + // Something is wrong but we got something for the user: no error here. + // console.warn("expected", this.centralDirRecords, "records in central dir, got", this.files.length); + } + } + }, + /** + * Read the end of central directory. + */ + readEndOfCentral: function() { + var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END); + if (offset < 0) { + // Check if the content is a truncated zip or complete garbage. + // A "LOCAL_FILE_HEADER" is not required at the beginning (auto + // extractible zip for example) but it can give a good hint. + // If an ajax request was used without responseType, we will also + // get unreadable data. + var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER); + + if (isGarbage) { + throw new Error("Can't find end of central directory : is this a zip file ? " + + "If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"); + } else { + throw new Error("Corrupted zip: can't find end of central directory"); + } + + } + this.reader.setIndex(offset); + var endOfCentralDirOffset = offset; + this.checkSignature(sig.CENTRAL_DIRECTORY_END); + this.readBlockEndOfCentral(); + + + /* extract from the zip spec : + 4) If one of the fields in the end of central directory + record is too small to hold required data, the field + should be set to -1 (0xFFFF or 0xFFFFFFFF) and the + ZIP64 format record should be created. + 5) The end of central directory record and the + Zip64 end of central directory locator record must + reside on the same disk when splitting or spanning + an archive. + */ + if (this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) { + this.zip64 = true; + + /* + Warning : the zip64 extension is supported, but ONLY if the 64bits integer read from + the zip file can fit into a 32bits integer. This cannot be solved : JavaScript represents + all numbers as 64-bit double precision IEEE 754 floating point numbers. + So, we have 53bits for integers and bitwise operations treat everything as 32bits. + see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Operators/Bitwise_Operators + and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf section 8.5 + */ + + // should look for a zip64 EOCD locator + offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + if (offset < 0) { + throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator"); + } + this.reader.setIndex(offset); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR); + this.readBlockZip64EndOfCentralLocator(); + + // now the zip64 EOCD record + if (!this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END)) { + // console.warn("ZIP64 end of central directory not where expected."); + this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); + if (this.relativeOffsetEndOfZip64CentralDir < 0) { + throw new Error("Corrupted zip: can't find the ZIP64 end of central directory"); + } + } + this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir); + this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END); + this.readBlockZip64EndOfCentral(); + } + + var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize; + if (this.zip64) { + expectedEndOfCentralDirOffset += 20; // end of central dir 64 locator + expectedEndOfCentralDirOffset += 12 /* should not include the leading 12 bytes */ + this.zip64EndOfCentralSize; + } + + var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset; + + if (extraBytes > 0) { + // console.warn(extraBytes, "extra bytes at beginning or within zipfile"); + if (this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER)) { + // The offsets seem wrong, but we have something at the specified offset. + // So… we keep it. + } else { + // the offset is wrong, update the "zero" of the reader + // this happens if data has been prepended (crx files for example) + this.reader.zero = extraBytes; + } + } else if (extraBytes < 0) { + throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes."); + } + }, + prepareReader: function(data) { + this.reader = readerFor(data); + }, + /** + * Read a zip file and create ZipEntries. + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file. + */ + load: function(data) { + this.prepareReader(data); + this.readEndOfCentral(); + this.readCentralDir(); + this.readLocalFiles(); + } +}; +// }}} end of ZipEntries +module.exports = ZipEntries; + +},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(require,module,exports){ +'use strict'; +var readerFor = require('./reader/readerFor'); +var utils = require('./utils'); +var CompressedObject = require('./compressedObject'); +var crc32fn = require('./crc32'); +var utf8 = require('./utf8'); +var compressions = require('./compressions'); +var support = require('./support'); + +var MADE_BY_DOS = 0x00; +var MADE_BY_UNIX = 0x03; + +/** + * Find a compression registered in JSZip. + * @param {string} compressionMethod the method magic to find. + * @return {Object|null} the JSZip compression object, null if none found. + */ +var findCompression = function(compressionMethod) { + for (var method in compressions) { + if (!compressions.hasOwnProperty(method)) { + continue; + } + if (compressions[method].magic === compressionMethod) { + return compressions[method]; + } + } + return null; +}; + +// class ZipEntry {{{ +/** + * An entry in the zip file. + * @constructor + * @param {Object} options Options of the current file. + * @param {Object} loadOptions Options for loading the stream. + */ +function ZipEntry(options, loadOptions) { + this.options = options; + this.loadOptions = loadOptions; +} +ZipEntry.prototype = { + /** + * say if the file is encrypted. + * @return {boolean} true if the file is encrypted, false otherwise. + */ + isEncrypted: function() { + // bit 1 is set + return (this.bitFlag & 0x0001) === 0x0001; + }, + /** + * say if the file has utf-8 filename/comment. + * @return {boolean} true if the filename/comment is in utf-8, false otherwise. + */ + useUTF8: function() { + // bit 11 is set + return (this.bitFlag & 0x0800) === 0x0800; + }, + /** + * Read the local part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readLocalPart: function(reader) { + var compression, localExtraFieldsLength; + + // we already know everything from the central dir ! + // If the central dir data are false, we are doomed. + // On the bright side, the local part is scary : zip64, data descriptors, both, etc. + // The less data we get here, the more reliable this should be. + // Let's skip the whole header and dash to the data ! + reader.skip(22); + // in some zip created on windows, the filename stored in the central dir contains \ instead of /. + // Strangely, the filename here is OK. + // I would love to treat these zip files as corrupted (see http://www.info-zip.org/FAQ.html#backslashes + // or APPNOTE#4.4.17.1, "All slashes MUST be forward slashes '/'") but there are a lot of bad zip generators... + // Search "unzip mismatching "local" filename continuing with "central" filename version" on + // the internet. + // + // I think I see the logic here : the central directory is used to display + // content and the local directory is used to extract the files. Mixing / and \ + // may be used to display \ to windows users and use / when extracting the files. + // Unfortunately, this lead also to some issues : http://seclists.org/fulldisclosure/2009/Sep/394 + this.fileNameLength = reader.readInt(2); + localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir + // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding. + this.fileName = reader.readData(this.fileNameLength); + reader.skip(localExtraFieldsLength); + + if (this.compressedSize === -1 || this.uncompressedSize === -1) { + throw new Error("Bug or corrupted zip : didn't get enough information from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)"); + } + + compression = findCompression(this.compressionMethod); + if (compression === null) { // no compression found + throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")"); + } + this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize)); + }, + + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readCentralPart: function(reader) { + this.versionMadeBy = reader.readInt(2); + reader.skip(2); + // this.versionNeeded = reader.readInt(2); + this.bitFlag = reader.readInt(2); + this.compressionMethod = reader.readString(2); + this.date = reader.readDate(); + this.crc32 = reader.readInt(4); + this.compressedSize = reader.readInt(4); + this.uncompressedSize = reader.readInt(4); + var fileNameLength = reader.readInt(2); + this.extraFieldsLength = reader.readInt(2); + this.fileCommentLength = reader.readInt(2); + this.diskNumberStart = reader.readInt(2); + this.internalFileAttributes = reader.readInt(2); + this.externalFileAttributes = reader.readInt(4); + this.localHeaderOffset = reader.readInt(4); + + if (this.isEncrypted()) { + throw new Error("Encrypted zip are not supported"); + } + + // will be read in the local part, see the comments there + reader.skip(fileNameLength); + this.readExtraFields(reader); + this.parseZIP64ExtraField(reader); + this.fileComment = reader.readData(this.fileCommentLength); + }, + + /** + * Parse the external file attributes and get the unix/dos permissions. + */ + processAttributes: function () { + this.unixPermissions = null; + this.dosPermissions = null; + var madeBy = this.versionMadeBy >> 8; + + // Check if we have the DOS directory flag set. + // We look for it in the DOS and UNIX permissions + // but some unknown platform could set it as a compatibility flag. + this.dir = this.externalFileAttributes & 0x0010 ? true : false; + + if(madeBy === MADE_BY_DOS) { + // first 6 bits (0 to 5) + this.dosPermissions = this.externalFileAttributes & 0x3F; + } + + if(madeBy === MADE_BY_UNIX) { + this.unixPermissions = (this.externalFileAttributes >> 16) & 0xFFFF; + // the octal permissions are in (this.unixPermissions & 0x01FF).toString(8); + } + + // fail safe : if the name ends with a / it probably means a folder + if (!this.dir && this.fileNameStr.slice(-1) === '/') { + this.dir = true; + } + }, + + /** + * Parse the ZIP64 extra field and merge the info in the current ZipEntry. + * @param {DataReader} reader the reader to use. + */ + parseZIP64ExtraField: function(reader) { + + if (!this.extraFields[0x0001]) { + return; + } + + // should be something, preparing the extra reader + var extraReader = readerFor(this.extraFields[0x0001].value); + + // I really hope that these 64bits integer can fit in 32 bits integer, because js + // won't let us have more. + if (this.uncompressedSize === utils.MAX_VALUE_32BITS) { + this.uncompressedSize = extraReader.readInt(8); + } + if (this.compressedSize === utils.MAX_VALUE_32BITS) { + this.compressedSize = extraReader.readInt(8); + } + if (this.localHeaderOffset === utils.MAX_VALUE_32BITS) { + this.localHeaderOffset = extraReader.readInt(8); + } + if (this.diskNumberStart === utils.MAX_VALUE_32BITS) { + this.diskNumberStart = extraReader.readInt(4); + } + }, + /** + * Read the central part of a zip file and add the info in this object. + * @param {DataReader} reader the reader to use. + */ + readExtraFields: function(reader) { + var end = reader.index + this.extraFieldsLength, + extraFieldId, + extraFieldLength, + extraFieldValue; + + if (!this.extraFields) { + this.extraFields = {}; + } + + while (reader.index + 4 < end) { + extraFieldId = reader.readInt(2); + extraFieldLength = reader.readInt(2); + extraFieldValue = reader.readData(extraFieldLength); + + this.extraFields[extraFieldId] = { + id: extraFieldId, + length: extraFieldLength, + value: extraFieldValue + }; + } + + reader.setIndex(end); + }, + /** + * Apply an UTF8 transformation if needed. + */ + handleUTF8: function() { + var decodeParamType = support.uint8array ? "uint8array" : "array"; + if (this.useUTF8()) { + this.fileNameStr = utf8.utf8decode(this.fileName); + this.fileCommentStr = utf8.utf8decode(this.fileComment); + } else { + var upath = this.findExtraFieldUnicodePath(); + if (upath !== null) { + this.fileNameStr = upath; + } else { + // ASCII text or unsupported code page + var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName); + this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray); + } + + var ucomment = this.findExtraFieldUnicodeComment(); + if (ucomment !== null) { + this.fileCommentStr = ucomment; + } else { + // ASCII text or unsupported code page + var commentByteArray = utils.transformTo(decodeParamType, this.fileComment); + this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray); + } + } + }, + + /** + * Find the unicode path declared in the extra field, if any. + * @return {String} the unicode path, null otherwise. + */ + findExtraFieldUnicodePath: function() { + var upathField = this.extraFields[0x7075]; + if (upathField) { + var extraReader = readerFor(upathField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the filename changed, this field is out of date. + if (crc32fn(this.fileName) !== extraReader.readInt(4)) { + return null; + } + + return utf8.utf8decode(extraReader.readData(upathField.length - 5)); + } + return null; + }, + + /** + * Find the unicode comment declared in the extra field, if any. + * @return {String} the unicode comment, null otherwise. + */ + findExtraFieldUnicodeComment: function() { + var ucommentField = this.extraFields[0x6375]; + if (ucommentField) { + var extraReader = readerFor(ucommentField.value); + + // wrong version + if (extraReader.readInt(1) !== 1) { + return null; + } + + // the crc of the comment changed, this field is out of date. + if (crc32fn(this.fileComment) !== extraReader.readInt(4)) { + return null; + } + + return utf8.utf8decode(extraReader.readData(ucommentField.length - 5)); + } + return null; + } +}; +module.exports = ZipEntry; + +},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(require,module,exports){ +'use strict'; + +var StreamHelper = require('./stream/StreamHelper'); +var DataWorker = require('./stream/DataWorker'); +var utf8 = require('./utf8'); +var CompressedObject = require('./compressedObject'); +var GenericWorker = require('./stream/GenericWorker'); + +/** + * A simple object representing a file in the zip file. + * @constructor + * @param {string} name the name of the file + * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data + * @param {Object} options the options of the file + */ +var ZipObject = function(name, data, options) { + this.name = name; + this.dir = options.dir; + this.date = options.date; + this.comment = options.comment; + this.unixPermissions = options.unixPermissions; + this.dosPermissions = options.dosPermissions; + + this._data = data; + this._dataBinary = options.binary; + // keep only the compression + this.options = { + compression : options.compression, + compressionOptions : options.compressionOptions + }; +}; + +ZipObject.prototype = { + /** + * Create an internal stream for the content of this object. + * @param {String} type the type of each chunk. + * @return StreamHelper the stream. + */ + internalStream: function (type) { + var result = null, outputType = "string"; + try { + if (!type) { + throw new Error("No output type specified."); + } + outputType = type.toLowerCase(); + var askUnicodeString = outputType === "string" || outputType === "text"; + if (outputType === "binarystring" || outputType === "text") { + outputType = "string"; + } + result = this._decompressWorker(); + + var isUnicodeString = !this._dataBinary; + + if (isUnicodeString && !askUnicodeString) { + result = result.pipe(new utf8.Utf8EncodeWorker()); + } + if (!isUnicodeString && askUnicodeString) { + result = result.pipe(new utf8.Utf8DecodeWorker()); + } + } catch (e) { + result = new GenericWorker("error"); + result.error(e); + } + + return new StreamHelper(result, outputType, ""); + }, + + /** + * Prepare the content in the asked type. + * @param {String} type the type of the result. + * @param {Function} onUpdate a function to call on each internal update. + * @return Promise the promise of the result. + */ + async: function (type, onUpdate) { + return this.internalStream(type).accumulate(onUpdate); + }, + + /** + * Prepare the content as a nodejs stream. + * @param {String} type the type of each chunk. + * @param {Function} onUpdate a function to call on each internal update. + * @return Stream the stream. + */ + nodeStream: function (type, onUpdate) { + return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate); + }, + + /** + * Return a worker for the compressed content. + * @private + * @param {Object} compression the compression object to use. + * @param {Object} compressionOptions the options to use when compressing. + * @return Worker the worker. + */ + _compressWorker: function (compression, compressionOptions) { + if ( + this._data instanceof CompressedObject && + this._data.compression.magic === compression.magic + ) { + return this._data.getCompressedWorker(); + } else { + var result = this._decompressWorker(); + if(!this._dataBinary) { + result = result.pipe(new utf8.Utf8EncodeWorker()); + } + return CompressedObject.createWorkerFrom(result, compression, compressionOptions); + } + }, + /** + * Return a worker for the decompressed content. + * @private + * @return Worker the worker. + */ + _decompressWorker : function () { + if (this._data instanceof CompressedObject) { + return this._data.getContentWorker(); + } else if (this._data instanceof GenericWorker) { + return this._data; + } else { + return new DataWorker(this._data); + } + } +}; + +var removedMethods = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"]; +var removedFn = function () { + throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide."); +}; + +for(var i = 0; i < removedMethods.length; i++) { + ZipObject.prototype[removedMethods[i]] = removedFn; +} +module.exports = ZipObject; + +},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(require,module,exports){ +(function (global){ +'use strict'; +var Mutation = global.MutationObserver || global.WebKitMutationObserver; + +var scheduleDrain; + +{ + if (Mutation) { + var called = 0; + var observer = new Mutation(nextTick); + var element = global.document.createTextNode(''); + observer.observe(element, { + characterData: true + }); + scheduleDrain = function () { + element.data = (called = ++called % 2); + }; + } else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') { + var channel = new global.MessageChannel(); + channel.port1.onmessage = nextTick; + scheduleDrain = function () { + channel.port2.postMessage(0); + }; + } else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) { + scheduleDrain = function () { + + // Create a + + + +
+
+
+ +

Chapter 5

+ + +
+
+
+ + + + diff --git a/docs/snippets/index.html b/docs/snippets/index.html index 8b50605d..20283edb 100644 --- a/docs/snippets/index.html +++ b/docs/snippets/index.html @@ -14,6 +14,7 @@

Code listings from the mathcomp book

Chapter 2
Chapter 3
Chapter 4
+Chapter 5
Chapter 6
Chapter 7_1
Chapter 7_2