tutuca 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6427,6 +6427,7 @@ var Record = (defaultValues, name) => {
6427
6427
  hasInitialized = true;
6428
6428
  const keys = Object.keys(defaultValues);
6429
6429
  const indices = RecordTypePrototype._indices = {};
6430
+ RecordTypePrototype._name = name;
6430
6431
  RecordTypePrototype._keys = keys;
6431
6432
  RecordTypePrototype._defaultValues = defaultValues;
6432
6433
  for (let i = 0;i < keys.length; i++) {
@@ -6820,6 +6821,62 @@ class RepeatImpl extends IndexedSeqImpl {
6820
6821
  this.prototype[Symbol.iterator] = this.prototype.values;
6821
6822
  }
6822
6823
  }
6824
+ var asValues = (collection) => isKeyed(collection) ? collection.valueSeq() : collection;
6825
+ function initCollectionConversions() {
6826
+ CollectionImpl.prototype.toMap = function toMap() {
6827
+ return Map2(this.toKeyedSeq());
6828
+ };
6829
+ CollectionImpl.prototype.toOrderedMap = function toOrderedMap() {
6830
+ return OrderedMap(this.toKeyedSeq());
6831
+ };
6832
+ CollectionImpl.prototype.toOrderedSet = function toOrderedSet() {
6833
+ return OrderedSet(asValues(this));
6834
+ };
6835
+ CollectionImpl.prototype.toSet = function toSet() {
6836
+ return Set2(asValues(this));
6837
+ };
6838
+ CollectionImpl.prototype.toStack = function toStack() {
6839
+ return Stack2(asValues(this));
6840
+ };
6841
+ CollectionImpl.prototype.toList = function toList() {
6842
+ return List(asValues(this));
6843
+ };
6844
+ CollectionImpl.prototype.countBy = function countBy(grouper, context) {
6845
+ const groups = Map2().asMutable();
6846
+ this.__iterate((v, k) => {
6847
+ groups.update(grouper.call(context, v, k, this), 0, (a) => a + 1);
6848
+ });
6849
+ return groups.asImmutable();
6850
+ };
6851
+ CollectionImpl.prototype.groupBy = function groupBy(grouper, context) {
6852
+ const isKeyedIter = isKeyed(this);
6853
+ const groups = (isOrdered(this) ? OrderedMap() : Map2()).asMutable();
6854
+ this.__iterate((v, k) => {
6855
+ groups.update(grouper.call(context, v, k, this), (a) => {
6856
+ a ??= [];
6857
+ a.push(isKeyedIter ? [k, v] : v);
6858
+ return a;
6859
+ });
6860
+ });
6861
+ return groups.map((arr) => reifyValues(this, arr)).asImmutable();
6862
+ };
6863
+ IndexedCollectionImpl.prototype.keySeq = function keySeq() {
6864
+ return Range(0, this.size);
6865
+ };
6866
+ MapImpl.prototype.sort = function sort(comparator) {
6867
+ return OrderedMap(sortFactory(this, comparator));
6868
+ };
6869
+ MapImpl.prototype.sortBy = function sortBy(mapper, comparator) {
6870
+ return OrderedMap(sortFactory(this, comparator, mapper));
6871
+ };
6872
+ SetImpl.prototype.sort = function sort(comparator) {
6873
+ return OrderedSet(sortFactory(this, comparator));
6874
+ };
6875
+ SetImpl.prototype.sortBy = function sortBy(mapper, comparator) {
6876
+ return OrderedSet(sortFactory(this, comparator, mapper));
6877
+ };
6878
+ }
6879
+ initCollectionConversions();
6823
6880
 
6824
6881
  // src/oo.js
6825
6882
  var BAD_VALUE = Symbol("BadValue");