make-mp-data 1.5.52 → 1.5.54

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.
package/components/ai.js CHANGED
@@ -70,7 +70,7 @@ function validator(schema) {
70
70
  if (!schema) valid = false;
71
71
 
72
72
  //must have 3 or more events
73
- if (schema.events.length < 3) valid = false;
73
+ if (schema?.events?.length < 3) valid = false;
74
74
 
75
75
  //must have 2 or more superProps
76
76
  if (Object.keys(schema.superProps).length < 2) valid = false;
@@ -83,7 +83,21 @@ function validator(schema) {
83
83
 
84
84
 
85
85
  if (require.main === module) {
86
- generateSchema(`a dungeons and dragons inspired game where players can create characters, join parties, and go on quests and fight bosses!`)
86
+ generateSchema(` a payments platform called popPay PopPay platform, enables facial recognition-based transactions for contact-free payments, entry, and verification. Users sign up with a selfie, and their image becomes a secure digital key stored in PopID’s cloud, allowing for streamlined interactions at participating businesses. This system aims to replace IDs, passwords, and loyalty cards, focusing on security and user control.
87
+
88
+ Customers choose
89
+ to be recognized
90
+ Guests opt-in by standing directly in front of camera or notifying cashier. PopID never identifies guests without their permission.
91
+
92
+ Personalized ordering experience
93
+ Personalized
94
+ ordering experience
95
+ Guests can be automatically signed in to loyalty programs, shown past orders, and offered customized recommendations.
96
+
97
+ Contact-free payment
98
+ Contact-free
99
+ payment
100
+ PopPay’s eWallet links to guest’s payment card or checking account and offers lower processing fees than credit and debit cards.`)
87
101
  .then((result) => {
88
102
  if (NODE_ENV === "dev") debugger;
89
103
  })
package/components/cli.js CHANGED
@@ -47,8 +47,7 @@ DATA MODEL: https://github.com/ak--47/make-mp-data/blob/main/default.js
47
47
  type: 'string'
48
48
  })
49
49
  .option("format", {
50
- demandOption: false,
51
- default: 'json',
50
+ demandOption: false,
52
51
  alias: 'f',
53
52
  describe: 'csv or json',
54
53
  type: 'string'
@@ -604,6 +604,306 @@ const locations = [
604
604
  "region": "Oklahoma",
605
605
  "city": "Oklahoma City"
606
606
  },
607
+ {
608
+ "country": "United States",
609
+ "country_code": "US",
610
+ "region": "Alabama",
611
+ "city": "Birmingham"
612
+ },
613
+ {
614
+ "country": "United States",
615
+ "country_code": "US",
616
+ "region": "Alaska",
617
+ "city": "Anchorage"
618
+ },
619
+ {
620
+ "country": "United States",
621
+ "country_code": "US",
622
+ "region": "Arizona",
623
+ "city": "Tucson"
624
+ },
625
+ {
626
+ "country": "United States",
627
+ "country_code": "US",
628
+ "region": "Arkansas",
629
+ "city": "Little Rock"
630
+ },
631
+ {
632
+ "country": "United States",
633
+ "country_code": "US",
634
+ "region": "California",
635
+ "city": "Long Beach"
636
+ },
637
+ {
638
+ "country": "United States",
639
+ "country_code": "US",
640
+ "region": "Colorado",
641
+ "city": "Colorado Springs"
642
+ },
643
+ {
644
+ "country": "United States",
645
+ "country_code": "US",
646
+ "region": "Connecticut",
647
+ "city": "Hartford"
648
+ },
649
+ {
650
+ "country": "United States",
651
+ "country_code": "US",
652
+ "region": "Delaware",
653
+ "city": "Wilmington"
654
+ },
655
+ {
656
+ "country": "United States",
657
+ "country_code": "US",
658
+ "region": "Florida",
659
+ "city": "Miami"
660
+ },
661
+ {
662
+ "country": "United States",
663
+ "country_code": "US",
664
+ "region": "Georgia",
665
+ "city": "Atlanta"
666
+ },
667
+ {
668
+ "country": "United States",
669
+ "country_code": "US",
670
+ "region": "Hawaii",
671
+ "city": "Honolulu"
672
+ },
673
+ {
674
+ "country": "United States",
675
+ "country_code": "US",
676
+ "region": "Idaho",
677
+ "city": "Boise"
678
+ },
679
+ {
680
+ "country": "United States",
681
+ "country_code": "US",
682
+ "region": "Illinois",
683
+ "city": "Naperville"
684
+ },
685
+ {
686
+ "country": "United States",
687
+ "country_code": "US",
688
+ "region": "Indiana",
689
+ "city": "Fort Wayne"
690
+ },
691
+ {
692
+ "country": "United States",
693
+ "country_code": "US",
694
+ "region": "Iowa",
695
+ "city": "Des Moines"
696
+ },
697
+ {
698
+ "country": "United States",
699
+ "country_code": "US",
700
+ "region": "Kansas",
701
+ "city": "Wichita"
702
+ },
703
+ {
704
+ "country": "United States",
705
+ "country_code": "US",
706
+ "region": "Kentucky",
707
+ "city": "Louisville"
708
+ },
709
+ {
710
+ "country": "United States",
711
+ "country_code": "US",
712
+ "region": "Louisiana",
713
+ "city": "New Orleans"
714
+ },
715
+ {
716
+ "country": "United States",
717
+ "country_code": "US",
718
+ "region": "Maine",
719
+ "city": "Portland"
720
+ },
721
+ {
722
+ "country": "United States",
723
+ "country_code": "US",
724
+ "region": "Maryland",
725
+ "city": "Baltimore"
726
+ },
727
+ {
728
+ "country": "United States",
729
+ "country_code": "US",
730
+ "region": "Massachusetts",
731
+ "city": "Boston"
732
+ },
733
+ {
734
+ "country": "United States",
735
+ "country_code": "US",
736
+ "region": "Michigan",
737
+ "city": "Detroit"
738
+ },
739
+ {
740
+ "country": "United States",
741
+ "country_code": "US",
742
+ "region": "Minnesota",
743
+ "city": "Minneapolis"
744
+ },
745
+ {
746
+ "country": "United States",
747
+ "country_code": "US",
748
+ "region": "Mississippi",
749
+ "city": "Jackson"
750
+ },
751
+ {
752
+ "country": "United States",
753
+ "country_code": "US",
754
+ "region": "Missouri",
755
+ "city": "Kansas City"
756
+ },
757
+ {
758
+ "country": "United States",
759
+ "country_code": "US",
760
+ "region": "Montana",
761
+ "city": "Billings"
762
+ },
763
+ {
764
+ "country": "United States",
765
+ "country_code": "US",
766
+ "region": "Nebraska",
767
+ "city": "Omaha"
768
+ },
769
+ {
770
+ "country": "United States",
771
+ "country_code": "US",
772
+ "region": "Nevada",
773
+ "city": "Reno"
774
+ },
775
+ {
776
+ "country": "United States",
777
+ "country_code": "US",
778
+ "region": "New Hampshire",
779
+ "city": "Manchester"
780
+ },
781
+ {
782
+ "country": "United States",
783
+ "country_code": "US",
784
+ "region": "New Jersey",
785
+ "city": "Newark"
786
+ },
787
+ {
788
+ "country": "United States",
789
+ "country_code": "US",
790
+ "region": "New Mexico",
791
+ "city": "Albuquerque"
792
+ },
793
+ {
794
+ "country": "United States",
795
+ "country_code": "US",
796
+ "region": "New York",
797
+ "city": "Buffalo"
798
+ },
799
+ {
800
+ "country": "United States",
801
+ "country_code": "US",
802
+ "region": "North Carolina",
803
+ "city": "Charlotte"
804
+ },
805
+ {
806
+ "country": "United States",
807
+ "country_code": "US",
808
+ "region": "North Dakota",
809
+ "city": "Fargo"
810
+ },
811
+ {
812
+ "country": "United States",
813
+ "country_code": "US",
814
+ "region": "Ohio",
815
+ "city": "Cleveland"
816
+ },
817
+ {
818
+ "country": "United States",
819
+ "country_code": "US",
820
+ "region": "Oklahoma",
821
+ "city": "Tulsa"
822
+ },
823
+ {
824
+ "country": "United States",
825
+ "country_code": "US",
826
+ "region": "Oregon",
827
+ "city": "Salem"
828
+ },
829
+ {
830
+ "country": "United States",
831
+ "country_code": "US",
832
+ "region": "Pennsylvania",
833
+ "city": "Pittsburgh"
834
+ },
835
+ {
836
+ "country": "United States",
837
+ "country_code": "US",
838
+ "region": "Rhode Island",
839
+ "city": "Providence"
840
+ },
841
+ {
842
+ "country": "United States",
843
+ "country_code": "US",
844
+ "region": "South Carolina",
845
+ "city": "Columbia"
846
+ },
847
+ {
848
+ "country": "United States",
849
+ "country_code": "US",
850
+ "region": "South Dakota",
851
+ "city": "Sioux Falls"
852
+ },
853
+ {
854
+ "country": "United States",
855
+ "country_code": "US",
856
+ "region": "Tennessee",
857
+ "city": "Knoxville"
858
+ },
859
+ {
860
+ "country": "United States",
861
+ "country_code": "US",
862
+ "region": "Texas",
863
+ "city": "El Paso"
864
+ },
865
+ {
866
+ "country": "United States",
867
+ "country_code": "US",
868
+ "region": "Utah",
869
+ "city": "Salt Lake City"
870
+ },
871
+ {
872
+ "country": "United States",
873
+ "country_code": "US",
874
+ "region": "Vermont",
875
+ "city": "Burlington"
876
+ },
877
+ {
878
+ "country": "United States",
879
+ "country_code": "US",
880
+ "region": "Virginia",
881
+ "city": "Virginia Beach"
882
+ },
883
+ {
884
+ "country": "United States",
885
+ "country_code": "US",
886
+ "region": "Washington",
887
+ "city": "Tacoma"
888
+ },
889
+ {
890
+ "country": "United States",
891
+ "country_code": "US",
892
+ "region": "West Virginia",
893
+ "city": "Charleston"
894
+ },
895
+ {
896
+ "country": "United States",
897
+ "country_code": "US",
898
+ "region": "Wisconsin",
899
+ "city": "Milwaukee"
900
+ },
901
+ {
902
+ "country": "United States",
903
+ "country_code": "US",
904
+ "region": "Wyoming",
905
+ "city": "Cheyenne"
906
+ },
607
907
  {
608
908
  "country": "China",
609
909
  "country_code": "CN",
@@ -193,9 +193,20 @@ function choose(value) {
193
193
  return chance.pickone(value);
194
194
  }
195
195
 
196
- // [[{}],[{}],[{}]] should return all
197
- if (Array.isArray(value) && typeof value[0] === "object" && hasSameKeys(value)) {
198
- return value;
196
+ // Now, if the resolved value is an array, use chance.pickone
197
+ if (Array.isArray(value) && value.every(item => typeof item === 'string')) {
198
+ return chance.pickone(value);
199
+ }
200
+
201
+ if (Array.isArray(value) && value.every(item => typeof item === 'number')) {
202
+ return chance.pickone(value);
203
+ }
204
+
205
+ if (Array.isArray(value) && value.every(item => typeof item === 'object')) {
206
+ if (hasSameKeys(value)) return value;
207
+ else {
208
+ if (process.env.NODE_ENV === "dev") debugger;
209
+ }
199
210
  }
200
211
 
201
212
  // ["","",""] should pick-a-winner
@@ -234,27 +245,27 @@ function choose(value) {
234
245
 
235
246
  function hasSameKeys(arr) {
236
247
  if (arr.length <= 1) {
237
- return true; // An empty array or an array with one object always has the same keys
248
+ return true; // An empty array or an array with one object always has the same keys
238
249
  }
239
-
250
+
240
251
  const firstKeys = Object.keys(arr[0]);
241
-
252
+
242
253
  for (let i = 1; i < arr.length; i++) {
243
- const currentKeys = Object.keys(arr[i]);
244
-
245
- if (currentKeys.length !== firstKeys.length) {
246
- return false; // Different number of keys
247
- }
248
-
249
- for (const key of firstKeys) {
250
- if (!currentKeys.includes(key)) {
251
- return false; // Key missing in current object
254
+ const currentKeys = Object.keys(arr[i]);
255
+
256
+ if (currentKeys.length !== firstKeys.length) {
257
+ return false; // Different number of keys
258
+ }
259
+
260
+ for (const key of firstKeys) {
261
+ if (!currentKeys.includes(key)) {
262
+ return false; // Key missing in current object
263
+ }
252
264
  }
253
- }
254
265
  }
255
-
266
+
256
267
  return true; // All objects have the same keys
257
- }
268
+ }
258
269
 
259
270
  /**
260
271
  * keeps picking from an array until the array is exhausted