@aiou/eslint-config 0.11.2 → 1.0.0

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/dist/index.mjs ADDED
@@ -0,0 +1,4364 @@
1
+ import { isPackageExists } from 'local-pkg';
2
+ import pluginComments from 'eslint-plugin-eslint-comments';
3
+ import ignoreGlobs from '@aiou/eslint-ignore';
4
+ import pluginImport from 'eslint-plugin-i';
5
+ import pluginImportNewlines from 'eslint-plugin-import-newlines';
6
+ import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
7
+ import pluginUnsedImports from 'eslint-plugin-unused-imports';
8
+ import pluginN from 'eslint-plugin-n';
9
+ import pluginPromise from 'eslint-plugin-promise';
10
+ import pluginRegexp from 'eslint-plugin-regexp';
11
+ import globals$1 from 'globals';
12
+ import pluginJsonc from 'eslint-plugin-jsonc';
13
+ import jsoncParser from 'jsonc-eslint-parser';
14
+ import pluginMarkdown from 'eslint-plugin-markdown';
15
+ import pluginNext from '@next/eslint-plugin-next';
16
+ import pluginProgress from '@aiou/eslint-plugin-progress';
17
+ import pluginReact from 'eslint-plugin-react';
18
+ import pluginReactHooks from 'eslint-plugin-react-hooks';
19
+ import pluginReactRefresh from 'eslint-plugin-react-refresh';
20
+ import pluginSSRFriendly from 'eslint-plugin-ssr-friendly';
21
+ import pluginTailwindcss from 'eslint-plugin-tailwindcss';
22
+ import pluginTypeScript from '@typescript-eslint/eslint-plugin';
23
+ import tsParser from '@typescript-eslint/parser';
24
+ import pluginETC from 'eslint-plugin-etc';
25
+ import pluginUnicorn from 'eslint-plugin-unicorn';
26
+ import pluginYaml from 'eslint-plugin-yml';
27
+ import yamlParser from 'yaml-eslint-parser';
28
+
29
+ const comments = () => {
30
+ const config = [
31
+ {
32
+ plugins: {
33
+ "eslint-comments": pluginComments
34
+ },
35
+ rules: {
36
+ ...pluginComments.configs.recommended.rules,
37
+ "eslint-comments/disable-enable-pair": "off"
38
+ }
39
+ }
40
+ ];
41
+ return config;
42
+ };
43
+
44
+ const ignores = () => {
45
+ const config = [
46
+ {
47
+ ignores: ignoreGlobs
48
+ }
49
+ ];
50
+ return config;
51
+ };
52
+
53
+ const GLOB_SCRIPT_EXT = "?([cm])[jt]s?(x)";
54
+ const GLOB_TEST_SCRIPT = "**/*.{spec,test}.?([cm])[jt]s?(x)";
55
+ const GLOB_TEST_DIRS = "**/{test,tests,__test__,__tests__}/**";
56
+ const GLOB_DTS = "**/*.d.ts";
57
+ const GLOB_TS = "**/*.?([cm])ts";
58
+ const GLOB_TSX = "**/*.?([cm])tsx";
59
+ const GLOB_JSX = "**/*.?([cm])jsx";
60
+ const GLOB_JSON = "**/*.json";
61
+ const GLOB_JSON5 = "**/*.json5";
62
+ const GLOB_JSONC = "**/*.jsonc";
63
+ const GLOB_MARKDOWN = "**/*.md";
64
+ const GLOB_YAML = "**/*.y?(a)ml";
65
+ const GLOB_WORKFLOW_YAML = "**/.github/**/*.y?(a)ml";
66
+
67
+ const imports = () => {
68
+ const config = [
69
+ {
70
+ plugins: {
71
+ import: pluginImport,
72
+ "simple-import-sort": pluginSimpleImportSort,
73
+ "import-newlines": pluginImportNewlines,
74
+ "unused-imports": pluginUnsedImports
75
+ },
76
+ rules: {
77
+ ...pluginImport.configs.recommended.rules,
78
+ // import
79
+ // off: controlled by import/order
80
+ "import/order": "off",
81
+ "sort-imports": "off",
82
+ "simple-import-sort/imports": [
83
+ "warn",
84
+ {
85
+ groups: [
86
+ // Side effect imports.
87
+ ["^\\u0000"],
88
+ // Node.js builtins prefixed with `node:`.
89
+ ["^node:"],
90
+ // Packages.
91
+ // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
92
+ ["^@?\\w"],
93
+ // Relative imports.
94
+ // Absolute imports and other imports such as `@/foo` or `~/foo`.
95
+ // Anything not matched in another group.
96
+ ["^", "^\\.", "^@/\\w", "^~/\\w"],
97
+ // Virtual modules prefixed with `virtual:`, rollup & vite favor
98
+ ["^virtual:"],
99
+ // Types
100
+ ["^[^/\\.].*\0$", "^\\..*\0$"]
101
+ ]
102
+ }
103
+ ],
104
+ "simple-import-sort/exports": "off",
105
+ "import/first": "error",
106
+ "import/newline-after-import": "error",
107
+ "import/no-duplicates": "error",
108
+ "import/no-mutable-exports": "error",
109
+ "import/no-unresolved": "off",
110
+ "import/no-absolute-path": "off",
111
+ "import/no-extraneous-dependencies": [
112
+ "error",
113
+ {
114
+ devDependencies: [
115
+ // ignore dev scripts
116
+ "**/scripts/**/*.{js,jsx,ts,tsx,cjs,mjs}",
117
+ "**/*.test.{js,jsx,ts,tsx,cjs,mjs}",
118
+ "**/*.spec.{js,jsx,ts,tsx,mjs,cjs}",
119
+ "**/*.config.{js,jsx,ts,tsx,cjs,mjs}",
120
+ // ignore require third packages in .eslintrc.* e.g. eslint-define-config
121
+ "**/.eslintrc.{js,cjs,mjs}"
122
+ ]
123
+ }
124
+ ],
125
+ // Not allow import { default as named }
126
+ "import/no-named-default": "warn",
127
+ "unused-imports/no-unused-imports": "error",
128
+ "unused-imports/no-unused-vars": [
129
+ "warn",
130
+ { vars: "all", varsIgnorePattern: "^_", args: "after-used", argsIgnorePattern: "^_" }
131
+ ],
132
+ // Enforce newlines inside named import
133
+ "import-newlines/enforce": [
134
+ "error",
135
+ {
136
+ items: 4,
137
+ "max-len": 120,
138
+ semi: false
139
+ }
140
+ ]
141
+ }
142
+ },
143
+ {
144
+ files: [GLOB_DTS],
145
+ rules: {
146
+ "import/no-duplicates": "off"
147
+ }
148
+ },
149
+ {
150
+ files: [GLOB_TSX, GLOB_JSX],
151
+ rules: {
152
+ // related: https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload
153
+ // export anonymous function: ReactRefresh failed
154
+ "import/no-anonymous-default-export": "error",
155
+ // perfer named export
156
+ "import/no-default-export": "error"
157
+ }
158
+ },
159
+ {
160
+ files: [
161
+ `**/*config*.${GLOB_SCRIPT_EXT}`,
162
+ `**/pages/**/*.${GLOB_SCRIPT_EXT}`,
163
+ "**/{index,vite,esbuild,rollup,webpack,rspack}.ts",
164
+ GLOB_DTS
165
+ ],
166
+ rules: {
167
+ // related: https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload
168
+ // export anonymous function: ReactRefresh failed
169
+ "import/no-anonymous-default-export": "off",
170
+ "import/no-default-export": "off"
171
+ }
172
+ }
173
+ ];
174
+ return config;
175
+ };
176
+
177
+ function getDefaultExportFromCjs (x) {
178
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
179
+ }
180
+
181
+ var eslintConfigStandardExports = {};
182
+ var eslintConfigStandard = {
183
+ get exports(){ return eslintConfigStandardExports; },
184
+ set exports(v){ eslintConfigStandardExports = v; },
185
+ };
186
+
187
+ var parserOptions = {
188
+ ecmaVersion: 2022,
189
+ ecmaFeatures: {
190
+ jsx: true
191
+ },
192
+ sourceType: "module"
193
+ };
194
+ var env = {
195
+ es2021: true,
196
+ node: true
197
+ };
198
+ var plugins = [
199
+ "import",
200
+ "n",
201
+ "promise"
202
+ ];
203
+ var globals = {
204
+ document: "readonly",
205
+ navigator: "readonly",
206
+ window: "readonly"
207
+ };
208
+ var rules = {
209
+ "no-var": "warn",
210
+ "object-shorthand": [
211
+ "warn",
212
+ "properties"
213
+ ],
214
+ "accessor-pairs": [
215
+ "error",
216
+ {
217
+ setWithoutGet: true,
218
+ enforceForClassMembers: true
219
+ }
220
+ ],
221
+ "array-bracket-spacing": [
222
+ "error",
223
+ "never"
224
+ ],
225
+ "array-callback-return": [
226
+ "error",
227
+ {
228
+ allowImplicit: false,
229
+ checkForEach: false
230
+ }
231
+ ],
232
+ "arrow-spacing": [
233
+ "error",
234
+ {
235
+ before: true,
236
+ after: true
237
+ }
238
+ ],
239
+ "block-spacing": [
240
+ "error",
241
+ "always"
242
+ ],
243
+ "brace-style": [
244
+ "error",
245
+ "1tbs",
246
+ {
247
+ allowSingleLine: true
248
+ }
249
+ ],
250
+ camelcase: [
251
+ "error",
252
+ {
253
+ allow: [
254
+ "^UNSAFE_"
255
+ ],
256
+ properties: "never",
257
+ ignoreGlobals: true
258
+ }
259
+ ],
260
+ "comma-dangle": [
261
+ "error",
262
+ {
263
+ arrays: "never",
264
+ objects: "never",
265
+ imports: "never",
266
+ exports: "never",
267
+ functions: "never"
268
+ }
269
+ ],
270
+ "comma-spacing": [
271
+ "error",
272
+ {
273
+ before: false,
274
+ after: true
275
+ }
276
+ ],
277
+ "comma-style": [
278
+ "error",
279
+ "last"
280
+ ],
281
+ "computed-property-spacing": [
282
+ "error",
283
+ "never",
284
+ {
285
+ enforceForClassMembers: true
286
+ }
287
+ ],
288
+ "constructor-super": "error",
289
+ curly: [
290
+ "error",
291
+ "multi-line"
292
+ ],
293
+ "default-case-last": "error",
294
+ "dot-location": [
295
+ "error",
296
+ "property"
297
+ ],
298
+ "dot-notation": [
299
+ "error",
300
+ {
301
+ allowKeywords: true
302
+ }
303
+ ],
304
+ "eol-last": "error",
305
+ eqeqeq: [
306
+ "error",
307
+ "always",
308
+ {
309
+ "null": "ignore"
310
+ }
311
+ ],
312
+ "func-call-spacing": [
313
+ "error",
314
+ "never"
315
+ ],
316
+ "generator-star-spacing": [
317
+ "error",
318
+ {
319
+ before: true,
320
+ after: true
321
+ }
322
+ ],
323
+ indent: [
324
+ "error",
325
+ 2,
326
+ {
327
+ SwitchCase: 1,
328
+ VariableDeclarator: 1,
329
+ outerIIFEBody: 1,
330
+ MemberExpression: 1,
331
+ FunctionDeclaration: {
332
+ parameters: 1,
333
+ body: 1
334
+ },
335
+ FunctionExpression: {
336
+ parameters: 1,
337
+ body: 1
338
+ },
339
+ CallExpression: {
340
+ "arguments": 1
341
+ },
342
+ ArrayExpression: 1,
343
+ ObjectExpression: 1,
344
+ ImportDeclaration: 1,
345
+ flatTernaryExpressions: false,
346
+ ignoreComments: false,
347
+ ignoredNodes: [
348
+ "TemplateLiteral *",
349
+ "JSXElement",
350
+ "JSXElement > *",
351
+ "JSXAttribute",
352
+ "JSXIdentifier",
353
+ "JSXNamespacedName",
354
+ "JSXMemberExpression",
355
+ "JSXSpreadAttribute",
356
+ "JSXExpressionContainer",
357
+ "JSXOpeningElement",
358
+ "JSXClosingElement",
359
+ "JSXFragment",
360
+ "JSXOpeningFragment",
361
+ "JSXClosingFragment",
362
+ "JSXText",
363
+ "JSXEmptyExpression",
364
+ "JSXSpreadChild"
365
+ ],
366
+ offsetTernaryExpressions: true
367
+ }
368
+ ],
369
+ "key-spacing": [
370
+ "error",
371
+ {
372
+ beforeColon: false,
373
+ afterColon: true
374
+ }
375
+ ],
376
+ "keyword-spacing": [
377
+ "error",
378
+ {
379
+ before: true,
380
+ after: true
381
+ }
382
+ ],
383
+ "lines-between-class-members": [
384
+ "error",
385
+ "always",
386
+ {
387
+ exceptAfterSingleLine: true
388
+ }
389
+ ],
390
+ "multiline-ternary": [
391
+ "error",
392
+ "always-multiline"
393
+ ],
394
+ "new-cap": [
395
+ "error",
396
+ {
397
+ newIsCap: true,
398
+ capIsNew: false,
399
+ properties: true
400
+ }
401
+ ],
402
+ "new-parens": "error",
403
+ "no-array-constructor": "error",
404
+ "no-async-promise-executor": "error",
405
+ "no-caller": "error",
406
+ "no-case-declarations": "error",
407
+ "no-class-assign": "error",
408
+ "no-compare-neg-zero": "error",
409
+ "no-cond-assign": "error",
410
+ "no-const-assign": "error",
411
+ "no-constant-condition": [
412
+ "error",
413
+ {
414
+ checkLoops: false
415
+ }
416
+ ],
417
+ "no-control-regex": "error",
418
+ "no-debugger": "error",
419
+ "no-delete-var": "error",
420
+ "no-dupe-args": "error",
421
+ "no-dupe-class-members": "error",
422
+ "no-dupe-keys": "error",
423
+ "no-duplicate-case": "error",
424
+ "no-useless-backreference": "error",
425
+ "no-empty": [
426
+ "error",
427
+ {
428
+ allowEmptyCatch: true
429
+ }
430
+ ],
431
+ "no-empty-character-class": "error",
432
+ "no-empty-pattern": "error",
433
+ "no-eval": "error",
434
+ "no-ex-assign": "error",
435
+ "no-extend-native": "error",
436
+ "no-extra-bind": "error",
437
+ "no-extra-boolean-cast": "error",
438
+ "no-extra-parens": [
439
+ "error",
440
+ "functions"
441
+ ],
442
+ "no-fallthrough": "error",
443
+ "no-floating-decimal": "error",
444
+ "no-func-assign": "error",
445
+ "no-global-assign": "error",
446
+ "no-implied-eval": "error",
447
+ "no-import-assign": "error",
448
+ "no-invalid-regexp": "error",
449
+ "no-irregular-whitespace": "error",
450
+ "no-iterator": "error",
451
+ "no-labels": [
452
+ "error",
453
+ {
454
+ allowLoop: false,
455
+ allowSwitch: false
456
+ }
457
+ ],
458
+ "no-lone-blocks": "error",
459
+ "no-loss-of-precision": "error",
460
+ "no-misleading-character-class": "error",
461
+ "no-prototype-builtins": "error",
462
+ "no-useless-catch": "error",
463
+ "no-mixed-operators": [
464
+ "error",
465
+ {
466
+ groups: [
467
+ [
468
+ "==",
469
+ "!=",
470
+ "===",
471
+ "!==",
472
+ ">",
473
+ ">=",
474
+ "<",
475
+ "<="
476
+ ],
477
+ [
478
+ "&&",
479
+ "||"
480
+ ],
481
+ [
482
+ "in",
483
+ "instanceof"
484
+ ]
485
+ ],
486
+ allowSamePrecedence: true
487
+ }
488
+ ],
489
+ "no-mixed-spaces-and-tabs": "error",
490
+ "no-multi-spaces": "error",
491
+ "no-multi-str": "error",
492
+ "no-multiple-empty-lines": [
493
+ "error",
494
+ {
495
+ max: 1,
496
+ maxBOF: 0,
497
+ maxEOF: 0
498
+ }
499
+ ],
500
+ "no-new": "error",
501
+ "no-new-func": "error",
502
+ "no-new-object": "error",
503
+ "no-new-symbol": "error",
504
+ "no-new-wrappers": "error",
505
+ "no-obj-calls": "error",
506
+ "no-octal": "error",
507
+ "no-octal-escape": "error",
508
+ "no-proto": "error",
509
+ "no-redeclare": [
510
+ "error",
511
+ {
512
+ builtinGlobals: false
513
+ }
514
+ ],
515
+ "no-regex-spaces": "error",
516
+ "no-return-assign": [
517
+ "error",
518
+ "except-parens"
519
+ ],
520
+ "no-self-assign": [
521
+ "error",
522
+ {
523
+ props: true
524
+ }
525
+ ],
526
+ "no-self-compare": "error",
527
+ "no-sequences": "error",
528
+ "no-shadow-restricted-names": "error",
529
+ "no-sparse-arrays": "error",
530
+ "no-tabs": "error",
531
+ "no-template-curly-in-string": "error",
532
+ "no-this-before-super": "error",
533
+ "no-throw-literal": "error",
534
+ "no-trailing-spaces": "error",
535
+ "no-undef": "error",
536
+ "no-undef-init": "error",
537
+ "no-unexpected-multiline": "error",
538
+ "no-unmodified-loop-condition": "error",
539
+ "no-unneeded-ternary": [
540
+ "error",
541
+ {
542
+ defaultAssignment: false
543
+ }
544
+ ],
545
+ "no-unreachable": "error",
546
+ "no-unreachable-loop": "error",
547
+ "no-unsafe-finally": "error",
548
+ "no-unsafe-negation": "error",
549
+ "no-unused-expressions": [
550
+ "error",
551
+ {
552
+ allowShortCircuit: true,
553
+ allowTernary: true,
554
+ allowTaggedTemplates: true
555
+ }
556
+ ],
557
+ "no-unused-vars": [
558
+ "error",
559
+ {
560
+ args: "none",
561
+ caughtErrors: "none",
562
+ ignoreRestSiblings: true,
563
+ vars: "all"
564
+ }
565
+ ],
566
+ "no-use-before-define": [
567
+ "error",
568
+ {
569
+ functions: false,
570
+ classes: false,
571
+ variables: false
572
+ }
573
+ ],
574
+ "no-useless-call": "error",
575
+ "no-useless-computed-key": "error",
576
+ "no-useless-constructor": "error",
577
+ "no-useless-escape": "error",
578
+ "no-useless-rename": "error",
579
+ "no-useless-return": "error",
580
+ "no-void": "error",
581
+ "no-whitespace-before-property": "error",
582
+ "no-with": "error",
583
+ "object-curly-newline": [
584
+ "error",
585
+ {
586
+ multiline: true,
587
+ consistent: true
588
+ }
589
+ ],
590
+ "object-curly-spacing": [
591
+ "error",
592
+ "always"
593
+ ],
594
+ "object-property-newline": [
595
+ "error",
596
+ {
597
+ allowMultiplePropertiesPerLine: true
598
+ }
599
+ ],
600
+ "one-var": [
601
+ "error",
602
+ {
603
+ initialized: "never"
604
+ }
605
+ ],
606
+ "operator-linebreak": [
607
+ "error",
608
+ "after",
609
+ {
610
+ overrides: {
611
+ "?": "before",
612
+ ":": "before",
613
+ "|>": "before"
614
+ }
615
+ }
616
+ ],
617
+ "padded-blocks": [
618
+ "error",
619
+ {
620
+ blocks: "never",
621
+ switches: "never",
622
+ classes: "never"
623
+ }
624
+ ],
625
+ "prefer-const": [
626
+ "error",
627
+ {
628
+ destructuring: "all"
629
+ }
630
+ ],
631
+ "prefer-promise-reject-errors": "error",
632
+ "prefer-regex-literals": [
633
+ "error",
634
+ {
635
+ disallowRedundantWrapping: true
636
+ }
637
+ ],
638
+ "quote-props": [
639
+ "error",
640
+ "as-needed"
641
+ ],
642
+ quotes: [
643
+ "error",
644
+ "single",
645
+ {
646
+ avoidEscape: true,
647
+ allowTemplateLiterals: false
648
+ }
649
+ ],
650
+ "rest-spread-spacing": [
651
+ "error",
652
+ "never"
653
+ ],
654
+ semi: [
655
+ "error",
656
+ "never"
657
+ ],
658
+ "semi-spacing": [
659
+ "error",
660
+ {
661
+ before: false,
662
+ after: true
663
+ }
664
+ ],
665
+ "space-before-blocks": [
666
+ "error",
667
+ "always"
668
+ ],
669
+ "space-before-function-paren": [
670
+ "error",
671
+ "always"
672
+ ],
673
+ "space-in-parens": [
674
+ "error",
675
+ "never"
676
+ ],
677
+ "space-infix-ops": "error",
678
+ "space-unary-ops": [
679
+ "error",
680
+ {
681
+ words: true,
682
+ nonwords: false
683
+ }
684
+ ],
685
+ "spaced-comment": [
686
+ "error",
687
+ "always",
688
+ {
689
+ line: {
690
+ markers: [
691
+ "*package",
692
+ "!",
693
+ "/",
694
+ ",",
695
+ "="
696
+ ]
697
+ },
698
+ block: {
699
+ balanced: true,
700
+ markers: [
701
+ "*package",
702
+ "!",
703
+ ",",
704
+ ":",
705
+ "::",
706
+ "flow-include"
707
+ ],
708
+ exceptions: [
709
+ "*"
710
+ ]
711
+ }
712
+ }
713
+ ],
714
+ "symbol-description": "error",
715
+ "template-curly-spacing": [
716
+ "error",
717
+ "never"
718
+ ],
719
+ "template-tag-spacing": [
720
+ "error",
721
+ "never"
722
+ ],
723
+ "unicode-bom": [
724
+ "error",
725
+ "never"
726
+ ],
727
+ "use-isnan": [
728
+ "error",
729
+ {
730
+ enforceForSwitchCase: true,
731
+ enforceForIndexOf: true
732
+ }
733
+ ],
734
+ "valid-typeof": [
735
+ "error",
736
+ {
737
+ requireStringLiterals: true
738
+ }
739
+ ],
740
+ "wrap-iife": [
741
+ "error",
742
+ "any",
743
+ {
744
+ functionPrototypeMethods: true
745
+ }
746
+ ],
747
+ "yield-star-spacing": [
748
+ "error",
749
+ "both"
750
+ ],
751
+ yoda: [
752
+ "error",
753
+ "never"
754
+ ],
755
+ "import/export": "error",
756
+ "import/first": "error",
757
+ "import/no-absolute-path": [
758
+ "error",
759
+ {
760
+ esmodule: true,
761
+ commonjs: true,
762
+ amd: false
763
+ }
764
+ ],
765
+ "import/no-duplicates": "error",
766
+ "import/no-named-default": "error",
767
+ "import/no-webpack-loader-syntax": "error",
768
+ "n/handle-callback-err": [
769
+ "error",
770
+ "^(err|error)$"
771
+ ],
772
+ "n/no-callback-literal": "error",
773
+ "n/no-deprecated-api": "error",
774
+ "n/no-exports-assign": "error",
775
+ "n/no-new-require": "error",
776
+ "n/no-path-concat": "error",
777
+ "n/process-exit-as-throw": "error",
778
+ "promise/param-names": "error"
779
+ };
780
+ var require$$0 = {
781
+ parserOptions: parserOptions,
782
+ env: env,
783
+ plugins: plugins,
784
+ globals: globals,
785
+ rules: rules
786
+ };
787
+
788
+ /*! eslint-config-standard. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
789
+
790
+ (function (module) {
791
+ module.exports = require$$0;
792
+ } (eslintConfigStandard));
793
+
794
+ var pluginStandard = /*@__PURE__*/getDefaultExportFromCjs(eslintConfigStandardExports);
795
+
796
+ const javascript = () => {
797
+ const config = [
798
+ {
799
+ languageOptions: {
800
+ globals: {
801
+ ...globals$1.browser,
802
+ ...globals$1.es2021,
803
+ ...globals$1.node
804
+ },
805
+ parserOptions: {
806
+ ecmaFeatures: {
807
+ jsx: true
808
+ },
809
+ // Eslint doesn't supply ecmaVersion in `parser.js` `context.parserOptions`
810
+ // This is required to avoid ecmaVersion < 2015 error or 'import' / 'export' error
811
+ ecmaVersion: "latest",
812
+ sourceType: "module"
813
+ },
814
+ sourceType: "module"
815
+ },
816
+ settings: {
817
+ // This will do the trick
818
+ "import/parsers": {
819
+ espree: [".js", ".cjs", ".mjs", ".jsx"]
820
+ },
821
+ "import/resolver": {
822
+ node: true
823
+ }
824
+ },
825
+ plugins: {
826
+ n: pluginN,
827
+ promise: pluginPromise,
828
+ regexp: pluginRegexp
829
+ },
830
+ rules: {
831
+ ...pluginStandard.rules,
832
+ ...pluginRegexp.configs.recommended.rules,
833
+ // Common
834
+ semi: ["error", "never"],
835
+ // Always need {}
836
+ curly: ["error", "all"],
837
+ quotes: ["error", "single"],
838
+ "quote-props": ["error", "as-needed"],
839
+ "no-unused-vars": "warn",
840
+ "no-param-reassign": "off",
841
+ "array-bracket-spacing": ["error", "never"],
842
+ // https://eslint.org/docs/latest/rules/brace-style#1tbs
843
+ "brace-style": ["error", "1tbs"],
844
+ "block-spacing": ["error", "always"],
845
+ camelcase: "off",
846
+ "comma-spacing": ["error", { before: false, after: true }],
847
+ "comma-style": ["error", "last"],
848
+ "comma-dangle": ["error", "always-multiline"],
849
+ "no-constant-condition": "warn",
850
+ "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
851
+ "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
852
+ "no-cond-assign": ["error", "always"],
853
+ "func-call-spacing": ["off", "never"],
854
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
855
+ // https://github.com/prettier/prettier-eslint/issues/226
856
+ indent: ["error", 2, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
857
+ "no-restricted-syntax": [
858
+ "error",
859
+ "DebuggerStatement",
860
+ "LabeledStatement",
861
+ "WithStatement"
862
+ ],
863
+ "object-curly-spacing": ["error", "always"],
864
+ "no-return-await": "off",
865
+ "space-before-function-paren": ["error", "never"],
866
+ // es6
867
+ "no-var": "error",
868
+ "prefer-const": [
869
+ "error",
870
+ {
871
+ destructuring: "any",
872
+ ignoreReadBeforeAssign: true
873
+ }
874
+ ],
875
+ "prefer-arrow-callback": [
876
+ "error",
877
+ {
878
+ allowNamedFunctions: false,
879
+ allowUnboundThis: true
880
+ }
881
+ ],
882
+ "object-shorthand": [
883
+ "error",
884
+ "always",
885
+ {
886
+ ignoreConstructors: false,
887
+ avoidQuotes: true
888
+ }
889
+ ],
890
+ "prefer-exponentiation-operator": "error",
891
+ "prefer-rest-params": "error",
892
+ "prefer-spread": "error",
893
+ "prefer-template": "error",
894
+ "template-curly-spacing": "error",
895
+ "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
896
+ "generator-star-spacing": "off",
897
+ // best-practice
898
+ "array-callback-return": "error",
899
+ "block-scoped-var": "error",
900
+ "consistent-return": "off",
901
+ complexity: ["off", 11],
902
+ eqeqeq: ["error", "allow-null"],
903
+ "no-alert": "warn",
904
+ "no-case-declarations": "error",
905
+ "no-multi-spaces": "error",
906
+ "no-multi-str": "error",
907
+ "no-with": "error",
908
+ "no-void": "error",
909
+ "no-useless-escape": "off",
910
+ "vars-on-top": "error",
911
+ "require-await": "off",
912
+ "no-return-assign": "off",
913
+ "operator-linebreak": ["error", "before"]
914
+ }
915
+ }
916
+ ];
917
+ return config;
918
+ };
919
+
920
+ const jsonc = () => {
921
+ const config = [
922
+ {
923
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
924
+ languageOptions: {
925
+ parser: jsoncParser
926
+ },
927
+ plugins: {
928
+ jsonc: pluginJsonc
929
+ }
930
+ },
931
+ {
932
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
933
+ rules: {
934
+ ...pluginJsonc.configs["recommended-with-jsonc"].rules,
935
+ // refs: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/indent.html
936
+ "jsonc/array-bracket-newline": [
937
+ "error",
938
+ {
939
+ multiline: true,
940
+ minItems: null
941
+ }
942
+ ],
943
+ "jsonc/array-bracket-spacing": ["error", "never"],
944
+ "jsonc/comma-dangle": ["error", "never"],
945
+ "jsonc/comma-style": ["error", "last"],
946
+ "jsonc/indent": ["error", 2, {}],
947
+ "jsonc/key-spacing": [
948
+ "error",
949
+ {
950
+ beforeColon: false,
951
+ afterColon: true,
952
+ mode: "strict"
953
+ }
954
+ ],
955
+ "jsonc/no-octal-escape": "error",
956
+ "jsonc/object-curly-newline": ["error", { multiline: true, consistent: true }],
957
+ "jsonc/object-curly-spacing": ["error", "always"]
958
+ }
959
+ },
960
+ {
961
+ files: ["**/package.json"],
962
+ rules: {
963
+ "jsonc/sort-keys": [
964
+ "error",
965
+ {
966
+ pathPattern: "^$",
967
+ order: [
968
+ "name",
969
+ "version",
970
+ "type",
971
+ "private",
972
+ "packageManager",
973
+ "description",
974
+ "keywords",
975
+ "license",
976
+ "engines",
977
+ "homepage",
978
+ "repository",
979
+ "bugs",
980
+ "funding",
981
+ "author",
982
+ "sideEffects",
983
+ "files",
984
+ "bin",
985
+ "exports",
986
+ "main",
987
+ "module",
988
+ "browser",
989
+ "typings",
990
+ "types",
991
+ "typeVersions",
992
+ "unpkg",
993
+ "scripts",
994
+ "husky",
995
+ "lint-staged",
996
+ "peerDependencies",
997
+ "peerDependenciesMeta",
998
+ "dependencies",
999
+ "optionalDependencies",
1000
+ "devDependencies",
1001
+ "pnpm",
1002
+ "overrides",
1003
+ "resolutions",
1004
+ "eslintConfig",
1005
+ "config"
1006
+ ]
1007
+ },
1008
+ {
1009
+ pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$",
1010
+ order: { type: "asc" }
1011
+ },
1012
+ {
1013
+ pathPattern: "^exports.*$",
1014
+ // According to webpack, default condition should be last item
1015
+ order: ["import", "require", "types", "node", "browser", "default"]
1016
+ },
1017
+ {
1018
+ order: { type: "asc" },
1019
+ pathPattern: "^resolutions$"
1020
+ },
1021
+ {
1022
+ order: { type: "asc" },
1023
+ pathPattern: "^pnpm.overrides$"
1024
+ }
1025
+ ]
1026
+ }
1027
+ },
1028
+ // refs: https://github.com/sxzz/eslint-config/blob/main/src/configs/sort.ts
1029
+ {
1030
+ files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1031
+ rules: {
1032
+ "jsonc/sort-keys": [
1033
+ "error",
1034
+ {
1035
+ order: [
1036
+ "extends",
1037
+ "compilerOptions",
1038
+ "references",
1039
+ "files",
1040
+ "include",
1041
+ "exclude"
1042
+ ],
1043
+ pathPattern: "^$"
1044
+ },
1045
+ {
1046
+ order: [
1047
+ /* Projects */
1048
+ "incremental",
1049
+ "composite",
1050
+ "tsBuildInfoFile",
1051
+ "disableSourceOfProjectReferenceRedirect",
1052
+ "disableSolutionSearching",
1053
+ "disableReferencedProjectLoad",
1054
+ /* Language and Environment */
1055
+ "target",
1056
+ "jsx",
1057
+ "jsxFactory",
1058
+ "jsxFragmentFactory",
1059
+ "jsxImportSource",
1060
+ "lib",
1061
+ "moduleDetection",
1062
+ "noLib",
1063
+ "reactNamespace",
1064
+ "useDefineForClassFields",
1065
+ "emitDecoratorMetadata",
1066
+ "experimentalDecorators",
1067
+ /* Modules */
1068
+ "baseUrl",
1069
+ "rootDir",
1070
+ "rootDirs",
1071
+ "customConditions",
1072
+ "module",
1073
+ "moduleResolution",
1074
+ "moduleSuffixes",
1075
+ "noResolve",
1076
+ "paths",
1077
+ "resolveJsonModule",
1078
+ "resolvePackageJsonExports",
1079
+ "resolvePackageJsonImports",
1080
+ "typeRoots",
1081
+ "types",
1082
+ "allowArbitraryExtensions",
1083
+ "allowImportingTsExtensions",
1084
+ "allowUmdGlobalAccess",
1085
+ /* JavaScript Support */
1086
+ "allowJs",
1087
+ "checkJs",
1088
+ "maxNodeModuleJsDepth",
1089
+ /* Type Checking */
1090
+ "strict",
1091
+ "strictBindCallApply",
1092
+ "strictFunctionTypes",
1093
+ "strictNullChecks",
1094
+ "strictPropertyInitialization",
1095
+ "allowUnreachableCode",
1096
+ "allowUnusedLabels",
1097
+ "alwaysStrict",
1098
+ "exactOptionalPropertyTypes",
1099
+ "noFallthroughCasesInSwitch",
1100
+ "noImplicitAny",
1101
+ "noImplicitOverride",
1102
+ "noImplicitReturns",
1103
+ "noImplicitThis",
1104
+ "noPropertyAccessFromIndexSignature",
1105
+ "noUncheckedIndexedAccess",
1106
+ "noUnusedLocals",
1107
+ "noUnusedParameters",
1108
+ "useUnknownInCatchVariables",
1109
+ /* Emit */
1110
+ "declaration",
1111
+ "declarationDir",
1112
+ "declarationMap",
1113
+ "downlevelIteration",
1114
+ "emitBOM",
1115
+ "emitDeclarationOnly",
1116
+ "importHelpers",
1117
+ "importsNotUsedAsValues",
1118
+ "inlineSourceMap",
1119
+ "inlineSources",
1120
+ "mapRoot",
1121
+ "newLine",
1122
+ "noEmit",
1123
+ "noEmitHelpers",
1124
+ "noEmitOnError",
1125
+ "outDir",
1126
+ "outFile",
1127
+ "preserveConstEnums",
1128
+ "preserveValueImports",
1129
+ "removeComments",
1130
+ "sourceMap",
1131
+ "sourceRoot",
1132
+ "stripInternal",
1133
+ /* Interop Constraints */
1134
+ "allowSyntheticDefaultImports",
1135
+ "esModuleInterop",
1136
+ "forceConsistentCasingInFileNames",
1137
+ "isolatedModules",
1138
+ "preserveSymlinks",
1139
+ "verbatimModuleSyntax",
1140
+ /* Completeness */
1141
+ "skipDefaultLibCheck",
1142
+ "skipLibCheck"
1143
+ ],
1144
+ pathPattern: "^compilerOptions$"
1145
+ }
1146
+ ]
1147
+ }
1148
+ }
1149
+ ];
1150
+ return config;
1151
+ };
1152
+
1153
+ const markdown = () => {
1154
+ const config = [
1155
+ {
1156
+ // Enable the Markdown processor for all .md files.
1157
+ files: [GLOB_MARKDOWN],
1158
+ processor: "markdown/markdown",
1159
+ plugins: {
1160
+ markdown: pluginMarkdown
1161
+ }
1162
+ },
1163
+ {
1164
+ // Code blocks in markdown file
1165
+ files: [`${GLOB_MARKDOWN}/*.${GLOB_SCRIPT_EXT}`],
1166
+ languageOptions: {
1167
+ parserOptions: {
1168
+ ecmaFeatures: {
1169
+ // Adding a "use strict" directive at the top of
1170
+ // every code block is tedious and distracting, so
1171
+ // opt into strict mode parsing without the
1172
+ // directive.
1173
+ impliedStrict: true
1174
+ }
1175
+ }
1176
+ },
1177
+ rules: {
1178
+ ...pluginMarkdown.configs.recommended.overrides[1].rules,
1179
+ "react/display-name": "off",
1180
+ "@typescript-eslint/no-redeclare": "off",
1181
+ "@typescript-eslint/no-unused-vars": "off",
1182
+ "@typescript-eslint/no-use-before-define": "off",
1183
+ "@typescript-eslint/no-var-requires": "off",
1184
+ "@typescript-eslint/comma-dangle": "off",
1185
+ "@typescript-eslint/consistent-type-imports": "off",
1186
+ "@typescript-eslint/no-namespace": "off",
1187
+ "@typescript-eslint/no-require-imports": "off",
1188
+ "import/no-unresolved": "off",
1189
+ "unused-imports/no-unused-imports": "off",
1190
+ "unused-imports/no-unused-vars": "off",
1191
+ "no-alert": "off",
1192
+ "no-console": "off",
1193
+ "no-restricted-imports": "off",
1194
+ "no-undef": "off",
1195
+ "no-unused-expressions": "off",
1196
+ "no-unused-vars": "off",
1197
+ // Off imports
1198
+ "import/no-extraneous-dependencies": "off"
1199
+ }
1200
+ }
1201
+ ];
1202
+ return config;
1203
+ };
1204
+
1205
+ const next = () => {
1206
+ const config = [
1207
+ {
1208
+ files: [GLOB_JSX, GLOB_TSX],
1209
+ plugins: {
1210
+ "@next/next": pluginNext
1211
+ },
1212
+ rules: {
1213
+ // Enable rules for next project
1214
+ ...pluginNext.configs.recommended.rules
1215
+ }
1216
+ }
1217
+ ];
1218
+ return config;
1219
+ };
1220
+
1221
+ const progress = () => {
1222
+ const config = [
1223
+ {
1224
+ plugins: {
1225
+ progress: pluginProgress
1226
+ },
1227
+ rules: {
1228
+ "progress/activate": 1
1229
+ }
1230
+ }
1231
+ ];
1232
+ return config;
1233
+ };
1234
+
1235
+ /** Detect free variable `global` from Node.js. */
1236
+ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
1237
+
1238
+ /** Detect free variable `self`. */
1239
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
1240
+
1241
+ /** Used as a reference to the global object. */
1242
+ var root = freeGlobal || freeSelf || Function('return this')();
1243
+
1244
+ /** Built-in value references. */
1245
+ var Symbol = root.Symbol;
1246
+
1247
+ /** Used for built-in method references. */
1248
+ var objectProto$b = Object.prototype;
1249
+
1250
+ /** Used to check objects for own properties. */
1251
+ var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
1252
+
1253
+ /**
1254
+ * Used to resolve the
1255
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1256
+ * of values.
1257
+ */
1258
+ var nativeObjectToString$1 = objectProto$b.toString;
1259
+
1260
+ /** Built-in value references. */
1261
+ var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
1262
+
1263
+ /**
1264
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1265
+ *
1266
+ * @private
1267
+ * @param {*} value The value to query.
1268
+ * @returns {string} Returns the raw `toStringTag`.
1269
+ */
1270
+ function getRawTag(value) {
1271
+ var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
1272
+ tag = value[symToStringTag$1];
1273
+
1274
+ try {
1275
+ value[symToStringTag$1] = undefined;
1276
+ var unmasked = true;
1277
+ } catch (e) {}
1278
+
1279
+ var result = nativeObjectToString$1.call(value);
1280
+ if (unmasked) {
1281
+ if (isOwn) {
1282
+ value[symToStringTag$1] = tag;
1283
+ } else {
1284
+ delete value[symToStringTag$1];
1285
+ }
1286
+ }
1287
+ return result;
1288
+ }
1289
+
1290
+ /** Used for built-in method references. */
1291
+ var objectProto$a = Object.prototype;
1292
+
1293
+ /**
1294
+ * Used to resolve the
1295
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1296
+ * of values.
1297
+ */
1298
+ var nativeObjectToString = objectProto$a.toString;
1299
+
1300
+ /**
1301
+ * Converts `value` to a string using `Object.prototype.toString`.
1302
+ *
1303
+ * @private
1304
+ * @param {*} value The value to convert.
1305
+ * @returns {string} Returns the converted string.
1306
+ */
1307
+ function objectToString(value) {
1308
+ return nativeObjectToString.call(value);
1309
+ }
1310
+
1311
+ /** `Object#toString` result references. */
1312
+ var nullTag = '[object Null]',
1313
+ undefinedTag = '[object Undefined]';
1314
+
1315
+ /** Built-in value references. */
1316
+ var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1317
+
1318
+ /**
1319
+ * The base implementation of `getTag` without fallbacks for buggy environments.
1320
+ *
1321
+ * @private
1322
+ * @param {*} value The value to query.
1323
+ * @returns {string} Returns the `toStringTag`.
1324
+ */
1325
+ function baseGetTag(value) {
1326
+ if (value == null) {
1327
+ return value === undefined ? undefinedTag : nullTag;
1328
+ }
1329
+ return (symToStringTag && symToStringTag in Object(value))
1330
+ ? getRawTag(value)
1331
+ : objectToString(value);
1332
+ }
1333
+
1334
+ /**
1335
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1336
+ * and has a `typeof` result of "object".
1337
+ *
1338
+ * @static
1339
+ * @memberOf _
1340
+ * @since 4.0.0
1341
+ * @category Lang
1342
+ * @param {*} value The value to check.
1343
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1344
+ * @example
1345
+ *
1346
+ * _.isObjectLike({});
1347
+ * // => true
1348
+ *
1349
+ * _.isObjectLike([1, 2, 3]);
1350
+ * // => true
1351
+ *
1352
+ * _.isObjectLike(_.noop);
1353
+ * // => false
1354
+ *
1355
+ * _.isObjectLike(null);
1356
+ * // => false
1357
+ */
1358
+ function isObjectLike(value) {
1359
+ return value != null && typeof value == 'object';
1360
+ }
1361
+
1362
+ /** `Object#toString` result references. */
1363
+ var symbolTag$1 = '[object Symbol]';
1364
+
1365
+ /**
1366
+ * Checks if `value` is classified as a `Symbol` primitive or object.
1367
+ *
1368
+ * @static
1369
+ * @memberOf _
1370
+ * @since 4.0.0
1371
+ * @category Lang
1372
+ * @param {*} value The value to check.
1373
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
1374
+ * @example
1375
+ *
1376
+ * _.isSymbol(Symbol.iterator);
1377
+ * // => true
1378
+ *
1379
+ * _.isSymbol('abc');
1380
+ * // => false
1381
+ */
1382
+ function isSymbol(value) {
1383
+ return typeof value == 'symbol' ||
1384
+ (isObjectLike(value) && baseGetTag(value) == symbolTag$1);
1385
+ }
1386
+
1387
+ /**
1388
+ * A specialized version of `_.map` for arrays without support for iteratee
1389
+ * shorthands.
1390
+ *
1391
+ * @private
1392
+ * @param {Array} [array] The array to iterate over.
1393
+ * @param {Function} iteratee The function invoked per iteration.
1394
+ * @returns {Array} Returns the new mapped array.
1395
+ */
1396
+ function arrayMap(array, iteratee) {
1397
+ var index = -1,
1398
+ length = array == null ? 0 : array.length,
1399
+ result = Array(length);
1400
+
1401
+ while (++index < length) {
1402
+ result[index] = iteratee(array[index], index, array);
1403
+ }
1404
+ return result;
1405
+ }
1406
+
1407
+ /**
1408
+ * Checks if `value` is classified as an `Array` object.
1409
+ *
1410
+ * @static
1411
+ * @memberOf _
1412
+ * @since 0.1.0
1413
+ * @category Lang
1414
+ * @param {*} value The value to check.
1415
+ * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1416
+ * @example
1417
+ *
1418
+ * _.isArray([1, 2, 3]);
1419
+ * // => true
1420
+ *
1421
+ * _.isArray(document.body.children);
1422
+ * // => false
1423
+ *
1424
+ * _.isArray('abc');
1425
+ * // => false
1426
+ *
1427
+ * _.isArray(_.noop);
1428
+ * // => false
1429
+ */
1430
+ var isArray = Array.isArray;
1431
+
1432
+ /** Used as references for various `Number` constants. */
1433
+ var INFINITY$1 = 1 / 0;
1434
+
1435
+ /** Used to convert symbols to primitives and strings. */
1436
+ var symbolProto$1 = Symbol ? Symbol.prototype : undefined,
1437
+ symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
1438
+
1439
+ /**
1440
+ * The base implementation of `_.toString` which doesn't convert nullish
1441
+ * values to empty strings.
1442
+ *
1443
+ * @private
1444
+ * @param {*} value The value to process.
1445
+ * @returns {string} Returns the string.
1446
+ */
1447
+ function baseToString(value) {
1448
+ // Exit early for strings to avoid a performance hit in some environments.
1449
+ if (typeof value == 'string') {
1450
+ return value;
1451
+ }
1452
+ if (isArray(value)) {
1453
+ // Recursively convert values (susceptible to call stack limits).
1454
+ return arrayMap(value, baseToString) + '';
1455
+ }
1456
+ if (isSymbol(value)) {
1457
+ return symbolToString ? symbolToString.call(value) : '';
1458
+ }
1459
+ var result = (value + '');
1460
+ return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
1461
+ }
1462
+
1463
+ /**
1464
+ * Checks if `value` is the
1465
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1466
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1467
+ *
1468
+ * @static
1469
+ * @memberOf _
1470
+ * @since 0.1.0
1471
+ * @category Lang
1472
+ * @param {*} value The value to check.
1473
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1474
+ * @example
1475
+ *
1476
+ * _.isObject({});
1477
+ * // => true
1478
+ *
1479
+ * _.isObject([1, 2, 3]);
1480
+ * // => true
1481
+ *
1482
+ * _.isObject(_.noop);
1483
+ * // => true
1484
+ *
1485
+ * _.isObject(null);
1486
+ * // => false
1487
+ */
1488
+ function isObject(value) {
1489
+ var type = typeof value;
1490
+ return value != null && (type == 'object' || type == 'function');
1491
+ }
1492
+
1493
+ /**
1494
+ * This method returns the first argument it receives.
1495
+ *
1496
+ * @static
1497
+ * @since 0.1.0
1498
+ * @memberOf _
1499
+ * @category Util
1500
+ * @param {*} value Any value.
1501
+ * @returns {*} Returns `value`.
1502
+ * @example
1503
+ *
1504
+ * var object = { 'a': 1 };
1505
+ *
1506
+ * console.log(_.identity(object) === object);
1507
+ * // => true
1508
+ */
1509
+ function identity(value) {
1510
+ return value;
1511
+ }
1512
+
1513
+ /** `Object#toString` result references. */
1514
+ var asyncTag = '[object AsyncFunction]',
1515
+ funcTag$1 = '[object Function]',
1516
+ genTag = '[object GeneratorFunction]',
1517
+ proxyTag = '[object Proxy]';
1518
+
1519
+ /**
1520
+ * Checks if `value` is classified as a `Function` object.
1521
+ *
1522
+ * @static
1523
+ * @memberOf _
1524
+ * @since 0.1.0
1525
+ * @category Lang
1526
+ * @param {*} value The value to check.
1527
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1528
+ * @example
1529
+ *
1530
+ * _.isFunction(_);
1531
+ * // => true
1532
+ *
1533
+ * _.isFunction(/abc/);
1534
+ * // => false
1535
+ */
1536
+ function isFunction(value) {
1537
+ if (!isObject(value)) {
1538
+ return false;
1539
+ }
1540
+ // The use of `Object#toString` avoids issues with the `typeof` operator
1541
+ // in Safari 9 which returns 'object' for typed arrays and other constructors.
1542
+ var tag = baseGetTag(value);
1543
+ return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
1544
+ }
1545
+
1546
+ /** Used to detect overreaching core-js shims. */
1547
+ var coreJsData = root['__core-js_shared__'];
1548
+
1549
+ /** Used to detect methods masquerading as native. */
1550
+ var maskSrcKey = (function() {
1551
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
1552
+ return uid ? ('Symbol(src)_1.' + uid) : '';
1553
+ }());
1554
+
1555
+ /**
1556
+ * Checks if `func` has its source masked.
1557
+ *
1558
+ * @private
1559
+ * @param {Function} func The function to check.
1560
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1561
+ */
1562
+ function isMasked(func) {
1563
+ return !!maskSrcKey && (maskSrcKey in func);
1564
+ }
1565
+
1566
+ /** Used for built-in method references. */
1567
+ var funcProto$1 = Function.prototype;
1568
+
1569
+ /** Used to resolve the decompiled source of functions. */
1570
+ var funcToString$1 = funcProto$1.toString;
1571
+
1572
+ /**
1573
+ * Converts `func` to its source code.
1574
+ *
1575
+ * @private
1576
+ * @param {Function} func The function to convert.
1577
+ * @returns {string} Returns the source code.
1578
+ */
1579
+ function toSource(func) {
1580
+ if (func != null) {
1581
+ try {
1582
+ return funcToString$1.call(func);
1583
+ } catch (e) {}
1584
+ try {
1585
+ return (func + '');
1586
+ } catch (e) {}
1587
+ }
1588
+ return '';
1589
+ }
1590
+
1591
+ /**
1592
+ * Used to match `RegExp`
1593
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1594
+ */
1595
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1596
+
1597
+ /** Used to detect host constructors (Safari). */
1598
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
1599
+
1600
+ /** Used for built-in method references. */
1601
+ var funcProto = Function.prototype,
1602
+ objectProto$9 = Object.prototype;
1603
+
1604
+ /** Used to resolve the decompiled source of functions. */
1605
+ var funcToString = funcProto.toString;
1606
+
1607
+ /** Used to check objects for own properties. */
1608
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1609
+
1610
+ /** Used to detect if a method is native. */
1611
+ var reIsNative = RegExp('^' +
1612
+ funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
1613
+ .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
1614
+ );
1615
+
1616
+ /**
1617
+ * The base implementation of `_.isNative` without bad shim checks.
1618
+ *
1619
+ * @private
1620
+ * @param {*} value The value to check.
1621
+ * @returns {boolean} Returns `true` if `value` is a native function,
1622
+ * else `false`.
1623
+ */
1624
+ function baseIsNative(value) {
1625
+ if (!isObject(value) || isMasked(value)) {
1626
+ return false;
1627
+ }
1628
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
1629
+ return pattern.test(toSource(value));
1630
+ }
1631
+
1632
+ /**
1633
+ * Gets the value at `key` of `object`.
1634
+ *
1635
+ * @private
1636
+ * @param {Object} [object] The object to query.
1637
+ * @param {string} key The key of the property to get.
1638
+ * @returns {*} Returns the property value.
1639
+ */
1640
+ function getValue(object, key) {
1641
+ return object == null ? undefined : object[key];
1642
+ }
1643
+
1644
+ /**
1645
+ * Gets the native function at `key` of `object`.
1646
+ *
1647
+ * @private
1648
+ * @param {Object} object The object to query.
1649
+ * @param {string} key The key of the method to get.
1650
+ * @returns {*} Returns the function if it's native, else `undefined`.
1651
+ */
1652
+ function getNative(object, key) {
1653
+ var value = getValue(object, key);
1654
+ return baseIsNative(value) ? value : undefined;
1655
+ }
1656
+
1657
+ /* Built-in method references that are verified to be native. */
1658
+ var WeakMap = getNative(root, 'WeakMap');
1659
+
1660
+ var defineProperty = (function() {
1661
+ try {
1662
+ var func = getNative(Object, 'defineProperty');
1663
+ func({}, '', {});
1664
+ return func;
1665
+ } catch (e) {}
1666
+ }());
1667
+
1668
+ /** Used as references for various `Number` constants. */
1669
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
1670
+
1671
+ /** Used to detect unsigned integer values. */
1672
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
1673
+
1674
+ /**
1675
+ * Checks if `value` is a valid array-like index.
1676
+ *
1677
+ * @private
1678
+ * @param {*} value The value to check.
1679
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
1680
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1681
+ */
1682
+ function isIndex(value, length) {
1683
+ var type = typeof value;
1684
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
1685
+
1686
+ return !!length &&
1687
+ (type == 'number' ||
1688
+ (type != 'symbol' && reIsUint.test(value))) &&
1689
+ (value > -1 && value % 1 == 0 && value < length);
1690
+ }
1691
+
1692
+ /**
1693
+ * The base implementation of `assignValue` and `assignMergeValue` without
1694
+ * value checks.
1695
+ *
1696
+ * @private
1697
+ * @param {Object} object The object to modify.
1698
+ * @param {string} key The key of the property to assign.
1699
+ * @param {*} value The value to assign.
1700
+ */
1701
+ function baseAssignValue(object, key, value) {
1702
+ if (key == '__proto__' && defineProperty) {
1703
+ defineProperty(object, key, {
1704
+ 'configurable': true,
1705
+ 'enumerable': true,
1706
+ 'value': value,
1707
+ 'writable': true
1708
+ });
1709
+ } else {
1710
+ object[key] = value;
1711
+ }
1712
+ }
1713
+
1714
+ /**
1715
+ * Performs a
1716
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1717
+ * comparison between two values to determine if they are equivalent.
1718
+ *
1719
+ * @static
1720
+ * @memberOf _
1721
+ * @since 4.0.0
1722
+ * @category Lang
1723
+ * @param {*} value The value to compare.
1724
+ * @param {*} other The other value to compare.
1725
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1726
+ * @example
1727
+ *
1728
+ * var object = { 'a': 1 };
1729
+ * var other = { 'a': 1 };
1730
+ *
1731
+ * _.eq(object, object);
1732
+ * // => true
1733
+ *
1734
+ * _.eq(object, other);
1735
+ * // => false
1736
+ *
1737
+ * _.eq('a', 'a');
1738
+ * // => true
1739
+ *
1740
+ * _.eq('a', Object('a'));
1741
+ * // => false
1742
+ *
1743
+ * _.eq(NaN, NaN);
1744
+ * // => true
1745
+ */
1746
+ function eq(value, other) {
1747
+ return value === other || (value !== value && other !== other);
1748
+ }
1749
+
1750
+ /** Used as references for various `Number` constants. */
1751
+ var MAX_SAFE_INTEGER = 9007199254740991;
1752
+
1753
+ /**
1754
+ * Checks if `value` is a valid array-like length.
1755
+ *
1756
+ * **Note:** This method is loosely based on
1757
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
1758
+ *
1759
+ * @static
1760
+ * @memberOf _
1761
+ * @since 4.0.0
1762
+ * @category Lang
1763
+ * @param {*} value The value to check.
1764
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
1765
+ * @example
1766
+ *
1767
+ * _.isLength(3);
1768
+ * // => true
1769
+ *
1770
+ * _.isLength(Number.MIN_VALUE);
1771
+ * // => false
1772
+ *
1773
+ * _.isLength(Infinity);
1774
+ * // => false
1775
+ *
1776
+ * _.isLength('3');
1777
+ * // => false
1778
+ */
1779
+ function isLength(value) {
1780
+ return typeof value == 'number' &&
1781
+ value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1782
+ }
1783
+
1784
+ /**
1785
+ * Checks if `value` is array-like. A value is considered array-like if it's
1786
+ * not a function and has a `value.length` that's an integer greater than or
1787
+ * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1788
+ *
1789
+ * @static
1790
+ * @memberOf _
1791
+ * @since 4.0.0
1792
+ * @category Lang
1793
+ * @param {*} value The value to check.
1794
+ * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1795
+ * @example
1796
+ *
1797
+ * _.isArrayLike([1, 2, 3]);
1798
+ * // => true
1799
+ *
1800
+ * _.isArrayLike(document.body.children);
1801
+ * // => true
1802
+ *
1803
+ * _.isArrayLike('abc');
1804
+ * // => true
1805
+ *
1806
+ * _.isArrayLike(_.noop);
1807
+ * // => false
1808
+ */
1809
+ function isArrayLike(value) {
1810
+ return value != null && isLength(value.length) && !isFunction(value);
1811
+ }
1812
+
1813
+ /** Used for built-in method references. */
1814
+ var objectProto$8 = Object.prototype;
1815
+
1816
+ /**
1817
+ * Checks if `value` is likely a prototype object.
1818
+ *
1819
+ * @private
1820
+ * @param {*} value The value to check.
1821
+ * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1822
+ */
1823
+ function isPrototype(value) {
1824
+ var Ctor = value && value.constructor,
1825
+ proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$8;
1826
+
1827
+ return value === proto;
1828
+ }
1829
+
1830
+ /**
1831
+ * The base implementation of `_.times` without support for iteratee shorthands
1832
+ * or max array length checks.
1833
+ *
1834
+ * @private
1835
+ * @param {number} n The number of times to invoke `iteratee`.
1836
+ * @param {Function} iteratee The function invoked per iteration.
1837
+ * @returns {Array} Returns the array of results.
1838
+ */
1839
+ function baseTimes(n, iteratee) {
1840
+ var index = -1,
1841
+ result = Array(n);
1842
+
1843
+ while (++index < n) {
1844
+ result[index] = iteratee(index);
1845
+ }
1846
+ return result;
1847
+ }
1848
+
1849
+ /** `Object#toString` result references. */
1850
+ var argsTag$2 = '[object Arguments]';
1851
+
1852
+ /**
1853
+ * The base implementation of `_.isArguments`.
1854
+ *
1855
+ * @private
1856
+ * @param {*} value The value to check.
1857
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1858
+ */
1859
+ function baseIsArguments(value) {
1860
+ return isObjectLike(value) && baseGetTag(value) == argsTag$2;
1861
+ }
1862
+
1863
+ /** Used for built-in method references. */
1864
+ var objectProto$7 = Object.prototype;
1865
+
1866
+ /** Used to check objects for own properties. */
1867
+ var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
1868
+
1869
+ /** Built-in value references. */
1870
+ var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
1871
+
1872
+ /**
1873
+ * Checks if `value` is likely an `arguments` object.
1874
+ *
1875
+ * @static
1876
+ * @memberOf _
1877
+ * @since 0.1.0
1878
+ * @category Lang
1879
+ * @param {*} value The value to check.
1880
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
1881
+ * else `false`.
1882
+ * @example
1883
+ *
1884
+ * _.isArguments(function() { return arguments; }());
1885
+ * // => true
1886
+ *
1887
+ * _.isArguments([1, 2, 3]);
1888
+ * // => false
1889
+ */
1890
+ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
1891
+ return isObjectLike(value) && hasOwnProperty$6.call(value, 'callee') &&
1892
+ !propertyIsEnumerable$1.call(value, 'callee');
1893
+ };
1894
+
1895
+ /**
1896
+ * This method returns `false`.
1897
+ *
1898
+ * @static
1899
+ * @memberOf _
1900
+ * @since 4.13.0
1901
+ * @category Util
1902
+ * @returns {boolean} Returns `false`.
1903
+ * @example
1904
+ *
1905
+ * _.times(2, _.stubFalse);
1906
+ * // => [false, false]
1907
+ */
1908
+ function stubFalse() {
1909
+ return false;
1910
+ }
1911
+
1912
+ /** Detect free variable `exports`. */
1913
+ var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
1914
+
1915
+ /** Detect free variable `module`. */
1916
+ var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
1917
+
1918
+ /** Detect the popular CommonJS extension `module.exports`. */
1919
+ var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
1920
+
1921
+ /** Built-in value references. */
1922
+ var Buffer = moduleExports$1 ? root.Buffer : undefined;
1923
+
1924
+ /* Built-in method references for those with the same name as other `lodash` methods. */
1925
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1926
+
1927
+ /**
1928
+ * Checks if `value` is a buffer.
1929
+ *
1930
+ * @static
1931
+ * @memberOf _
1932
+ * @since 4.3.0
1933
+ * @category Lang
1934
+ * @param {*} value The value to check.
1935
+ * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1936
+ * @example
1937
+ *
1938
+ * _.isBuffer(new Buffer(2));
1939
+ * // => true
1940
+ *
1941
+ * _.isBuffer(new Uint8Array(2));
1942
+ * // => false
1943
+ */
1944
+ var isBuffer = nativeIsBuffer || stubFalse;
1945
+
1946
+ /** `Object#toString` result references. */
1947
+ var argsTag$1 = '[object Arguments]',
1948
+ arrayTag$1 = '[object Array]',
1949
+ boolTag$1 = '[object Boolean]',
1950
+ dateTag$1 = '[object Date]',
1951
+ errorTag$1 = '[object Error]',
1952
+ funcTag = '[object Function]',
1953
+ mapTag$2 = '[object Map]',
1954
+ numberTag$1 = '[object Number]',
1955
+ objectTag$2 = '[object Object]',
1956
+ regexpTag$1 = '[object RegExp]',
1957
+ setTag$2 = '[object Set]',
1958
+ stringTag$1 = '[object String]',
1959
+ weakMapTag$1 = '[object WeakMap]';
1960
+
1961
+ var arrayBufferTag$1 = '[object ArrayBuffer]',
1962
+ dataViewTag$2 = '[object DataView]',
1963
+ float32Tag = '[object Float32Array]',
1964
+ float64Tag = '[object Float64Array]',
1965
+ int8Tag = '[object Int8Array]',
1966
+ int16Tag = '[object Int16Array]',
1967
+ int32Tag = '[object Int32Array]',
1968
+ uint8Tag = '[object Uint8Array]',
1969
+ uint8ClampedTag = '[object Uint8ClampedArray]',
1970
+ uint16Tag = '[object Uint16Array]',
1971
+ uint32Tag = '[object Uint32Array]';
1972
+
1973
+ /** Used to identify `toStringTag` values of typed arrays. */
1974
+ var typedArrayTags = {};
1975
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
1976
+ typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
1977
+ typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
1978
+ typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
1979
+ typedArrayTags[uint32Tag] = true;
1980
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
1981
+ typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] =
1982
+ typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] =
1983
+ typedArrayTags[errorTag$1] = typedArrayTags[funcTag] =
1984
+ typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] =
1985
+ typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] =
1986
+ typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] =
1987
+ typedArrayTags[weakMapTag$1] = false;
1988
+
1989
+ /**
1990
+ * The base implementation of `_.isTypedArray` without Node.js optimizations.
1991
+ *
1992
+ * @private
1993
+ * @param {*} value The value to check.
1994
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1995
+ */
1996
+ function baseIsTypedArray(value) {
1997
+ return isObjectLike(value) &&
1998
+ isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
1999
+ }
2000
+
2001
+ /**
2002
+ * The base implementation of `_.unary` without support for storing metadata.
2003
+ *
2004
+ * @private
2005
+ * @param {Function} func The function to cap arguments for.
2006
+ * @returns {Function} Returns the new capped function.
2007
+ */
2008
+ function baseUnary(func) {
2009
+ return function(value) {
2010
+ return func(value);
2011
+ };
2012
+ }
2013
+
2014
+ /** Detect free variable `exports`. */
2015
+ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
2016
+
2017
+ /** Detect free variable `module`. */
2018
+ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
2019
+
2020
+ /** Detect the popular CommonJS extension `module.exports`. */
2021
+ var moduleExports = freeModule && freeModule.exports === freeExports;
2022
+
2023
+ /** Detect free variable `process` from Node.js. */
2024
+ var freeProcess = moduleExports && freeGlobal.process;
2025
+
2026
+ /** Used to access faster Node.js helpers. */
2027
+ var nodeUtil = (function() {
2028
+ try {
2029
+ // Use `util.types` for Node.js 10+.
2030
+ var types = freeModule && freeModule.require && freeModule.require('util').types;
2031
+
2032
+ if (types) {
2033
+ return types;
2034
+ }
2035
+
2036
+ // Legacy `process.binding('util')` for Node.js < 10.
2037
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
2038
+ } catch (e) {}
2039
+ }());
2040
+
2041
+ /* Node.js helper references. */
2042
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
2043
+
2044
+ /**
2045
+ * Checks if `value` is classified as a typed array.
2046
+ *
2047
+ * @static
2048
+ * @memberOf _
2049
+ * @since 3.0.0
2050
+ * @category Lang
2051
+ * @param {*} value The value to check.
2052
+ * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
2053
+ * @example
2054
+ *
2055
+ * _.isTypedArray(new Uint8Array);
2056
+ * // => true
2057
+ *
2058
+ * _.isTypedArray([]);
2059
+ * // => false
2060
+ */
2061
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
2062
+
2063
+ /** Used for built-in method references. */
2064
+ var objectProto$6 = Object.prototype;
2065
+
2066
+ /** Used to check objects for own properties. */
2067
+ var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
2068
+
2069
+ /**
2070
+ * Creates an array of the enumerable property names of the array-like `value`.
2071
+ *
2072
+ * @private
2073
+ * @param {*} value The value to query.
2074
+ * @param {boolean} inherited Specify returning inherited property names.
2075
+ * @returns {Array} Returns the array of property names.
2076
+ */
2077
+ function arrayLikeKeys(value, inherited) {
2078
+ var isArr = isArray(value),
2079
+ isArg = !isArr && isArguments(value),
2080
+ isBuff = !isArr && !isArg && isBuffer(value),
2081
+ isType = !isArr && !isArg && !isBuff && isTypedArray(value),
2082
+ skipIndexes = isArr || isArg || isBuff || isType,
2083
+ result = skipIndexes ? baseTimes(value.length, String) : [],
2084
+ length = result.length;
2085
+
2086
+ for (var key in value) {
2087
+ if ((inherited || hasOwnProperty$5.call(value, key)) &&
2088
+ !(skipIndexes && (
2089
+ // Safari 9 has enumerable `arguments.length` in strict mode.
2090
+ key == 'length' ||
2091
+ // Node.js 0.10 has enumerable non-index properties on buffers.
2092
+ (isBuff && (key == 'offset' || key == 'parent')) ||
2093
+ // PhantomJS 2 has enumerable non-index properties on typed arrays.
2094
+ (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
2095
+ // Skip index properties.
2096
+ isIndex(key, length)
2097
+ ))) {
2098
+ result.push(key);
2099
+ }
2100
+ }
2101
+ return result;
2102
+ }
2103
+
2104
+ /**
2105
+ * Creates a unary function that invokes `func` with its argument transformed.
2106
+ *
2107
+ * @private
2108
+ * @param {Function} func The function to wrap.
2109
+ * @param {Function} transform The argument transform.
2110
+ * @returns {Function} Returns the new function.
2111
+ */
2112
+ function overArg(func, transform) {
2113
+ return function(arg) {
2114
+ return func(transform(arg));
2115
+ };
2116
+ }
2117
+
2118
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2119
+ var nativeKeys = overArg(Object.keys, Object);
2120
+
2121
+ /** Used for built-in method references. */
2122
+ var objectProto$5 = Object.prototype;
2123
+
2124
+ /** Used to check objects for own properties. */
2125
+ var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
2126
+
2127
+ /**
2128
+ * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
2129
+ *
2130
+ * @private
2131
+ * @param {Object} object The object to query.
2132
+ * @returns {Array} Returns the array of property names.
2133
+ */
2134
+ function baseKeys(object) {
2135
+ if (!isPrototype(object)) {
2136
+ return nativeKeys(object);
2137
+ }
2138
+ var result = [];
2139
+ for (var key in Object(object)) {
2140
+ if (hasOwnProperty$4.call(object, key) && key != 'constructor') {
2141
+ result.push(key);
2142
+ }
2143
+ }
2144
+ return result;
2145
+ }
2146
+
2147
+ /**
2148
+ * Creates an array of the own enumerable property names of `object`.
2149
+ *
2150
+ * **Note:** Non-object values are coerced to objects. See the
2151
+ * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
2152
+ * for more details.
2153
+ *
2154
+ * @static
2155
+ * @since 0.1.0
2156
+ * @memberOf _
2157
+ * @category Object
2158
+ * @param {Object} object The object to query.
2159
+ * @returns {Array} Returns the array of property names.
2160
+ * @example
2161
+ *
2162
+ * function Foo() {
2163
+ * this.a = 1;
2164
+ * this.b = 2;
2165
+ * }
2166
+ *
2167
+ * Foo.prototype.c = 3;
2168
+ *
2169
+ * _.keys(new Foo);
2170
+ * // => ['a', 'b'] (iteration order is not guaranteed)
2171
+ *
2172
+ * _.keys('hi');
2173
+ * // => ['0', '1']
2174
+ */
2175
+ function keys(object) {
2176
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
2177
+ }
2178
+
2179
+ /** Used to match property names within property paths. */
2180
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
2181
+ reIsPlainProp = /^\w*$/;
2182
+
2183
+ /**
2184
+ * Checks if `value` is a property name and not a property path.
2185
+ *
2186
+ * @private
2187
+ * @param {*} value The value to check.
2188
+ * @param {Object} [object] The object to query keys on.
2189
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
2190
+ */
2191
+ function isKey(value, object) {
2192
+ if (isArray(value)) {
2193
+ return false;
2194
+ }
2195
+ var type = typeof value;
2196
+ if (type == 'number' || type == 'symbol' || type == 'boolean' ||
2197
+ value == null || isSymbol(value)) {
2198
+ return true;
2199
+ }
2200
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
2201
+ (object != null && value in Object(object));
2202
+ }
2203
+
2204
+ /* Built-in method references that are verified to be native. */
2205
+ var nativeCreate = getNative(Object, 'create');
2206
+
2207
+ /**
2208
+ * Removes all key-value entries from the hash.
2209
+ *
2210
+ * @private
2211
+ * @name clear
2212
+ * @memberOf Hash
2213
+ */
2214
+ function hashClear() {
2215
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
2216
+ this.size = 0;
2217
+ }
2218
+
2219
+ /**
2220
+ * Removes `key` and its value from the hash.
2221
+ *
2222
+ * @private
2223
+ * @name delete
2224
+ * @memberOf Hash
2225
+ * @param {Object} hash The hash to modify.
2226
+ * @param {string} key The key of the value to remove.
2227
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2228
+ */
2229
+ function hashDelete(key) {
2230
+ var result = this.has(key) && delete this.__data__[key];
2231
+ this.size -= result ? 1 : 0;
2232
+ return result;
2233
+ }
2234
+
2235
+ /** Used to stand-in for `undefined` hash values. */
2236
+ var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
2237
+
2238
+ /** Used for built-in method references. */
2239
+ var objectProto$4 = Object.prototype;
2240
+
2241
+ /** Used to check objects for own properties. */
2242
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
2243
+
2244
+ /**
2245
+ * Gets the hash value for `key`.
2246
+ *
2247
+ * @private
2248
+ * @name get
2249
+ * @memberOf Hash
2250
+ * @param {string} key The key of the value to get.
2251
+ * @returns {*} Returns the entry value.
2252
+ */
2253
+ function hashGet(key) {
2254
+ var data = this.__data__;
2255
+ if (nativeCreate) {
2256
+ var result = data[key];
2257
+ return result === HASH_UNDEFINED$2 ? undefined : result;
2258
+ }
2259
+ return hasOwnProperty$3.call(data, key) ? data[key] : undefined;
2260
+ }
2261
+
2262
+ /** Used for built-in method references. */
2263
+ var objectProto$3 = Object.prototype;
2264
+
2265
+ /** Used to check objects for own properties. */
2266
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
2267
+
2268
+ /**
2269
+ * Checks if a hash value for `key` exists.
2270
+ *
2271
+ * @private
2272
+ * @name has
2273
+ * @memberOf Hash
2274
+ * @param {string} key The key of the entry to check.
2275
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2276
+ */
2277
+ function hashHas(key) {
2278
+ var data = this.__data__;
2279
+ return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$2.call(data, key);
2280
+ }
2281
+
2282
+ /** Used to stand-in for `undefined` hash values. */
2283
+ var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
2284
+
2285
+ /**
2286
+ * Sets the hash `key` to `value`.
2287
+ *
2288
+ * @private
2289
+ * @name set
2290
+ * @memberOf Hash
2291
+ * @param {string} key The key of the value to set.
2292
+ * @param {*} value The value to set.
2293
+ * @returns {Object} Returns the hash instance.
2294
+ */
2295
+ function hashSet(key, value) {
2296
+ var data = this.__data__;
2297
+ this.size += this.has(key) ? 0 : 1;
2298
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
2299
+ return this;
2300
+ }
2301
+
2302
+ /**
2303
+ * Creates a hash object.
2304
+ *
2305
+ * @private
2306
+ * @constructor
2307
+ * @param {Array} [entries] The key-value pairs to cache.
2308
+ */
2309
+ function Hash(entries) {
2310
+ var index = -1,
2311
+ length = entries == null ? 0 : entries.length;
2312
+
2313
+ this.clear();
2314
+ while (++index < length) {
2315
+ var entry = entries[index];
2316
+ this.set(entry[0], entry[1]);
2317
+ }
2318
+ }
2319
+
2320
+ // Add methods to `Hash`.
2321
+ Hash.prototype.clear = hashClear;
2322
+ Hash.prototype['delete'] = hashDelete;
2323
+ Hash.prototype.get = hashGet;
2324
+ Hash.prototype.has = hashHas;
2325
+ Hash.prototype.set = hashSet;
2326
+
2327
+ /**
2328
+ * Removes all key-value entries from the list cache.
2329
+ *
2330
+ * @private
2331
+ * @name clear
2332
+ * @memberOf ListCache
2333
+ */
2334
+ function listCacheClear() {
2335
+ this.__data__ = [];
2336
+ this.size = 0;
2337
+ }
2338
+
2339
+ /**
2340
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
2341
+ *
2342
+ * @private
2343
+ * @param {Array} array The array to inspect.
2344
+ * @param {*} key The key to search for.
2345
+ * @returns {number} Returns the index of the matched value, else `-1`.
2346
+ */
2347
+ function assocIndexOf(array, key) {
2348
+ var length = array.length;
2349
+ while (length--) {
2350
+ if (eq(array[length][0], key)) {
2351
+ return length;
2352
+ }
2353
+ }
2354
+ return -1;
2355
+ }
2356
+
2357
+ /** Used for built-in method references. */
2358
+ var arrayProto = Array.prototype;
2359
+
2360
+ /** Built-in value references. */
2361
+ var splice = arrayProto.splice;
2362
+
2363
+ /**
2364
+ * Removes `key` and its value from the list cache.
2365
+ *
2366
+ * @private
2367
+ * @name delete
2368
+ * @memberOf ListCache
2369
+ * @param {string} key The key of the value to remove.
2370
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2371
+ */
2372
+ function listCacheDelete(key) {
2373
+ var data = this.__data__,
2374
+ index = assocIndexOf(data, key);
2375
+
2376
+ if (index < 0) {
2377
+ return false;
2378
+ }
2379
+ var lastIndex = data.length - 1;
2380
+ if (index == lastIndex) {
2381
+ data.pop();
2382
+ } else {
2383
+ splice.call(data, index, 1);
2384
+ }
2385
+ --this.size;
2386
+ return true;
2387
+ }
2388
+
2389
+ /**
2390
+ * Gets the list cache value for `key`.
2391
+ *
2392
+ * @private
2393
+ * @name get
2394
+ * @memberOf ListCache
2395
+ * @param {string} key The key of the value to get.
2396
+ * @returns {*} Returns the entry value.
2397
+ */
2398
+ function listCacheGet(key) {
2399
+ var data = this.__data__,
2400
+ index = assocIndexOf(data, key);
2401
+
2402
+ return index < 0 ? undefined : data[index][1];
2403
+ }
2404
+
2405
+ /**
2406
+ * Checks if a list cache value for `key` exists.
2407
+ *
2408
+ * @private
2409
+ * @name has
2410
+ * @memberOf ListCache
2411
+ * @param {string} key The key of the entry to check.
2412
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2413
+ */
2414
+ function listCacheHas(key) {
2415
+ return assocIndexOf(this.__data__, key) > -1;
2416
+ }
2417
+
2418
+ /**
2419
+ * Sets the list cache `key` to `value`.
2420
+ *
2421
+ * @private
2422
+ * @name set
2423
+ * @memberOf ListCache
2424
+ * @param {string} key The key of the value to set.
2425
+ * @param {*} value The value to set.
2426
+ * @returns {Object} Returns the list cache instance.
2427
+ */
2428
+ function listCacheSet(key, value) {
2429
+ var data = this.__data__,
2430
+ index = assocIndexOf(data, key);
2431
+
2432
+ if (index < 0) {
2433
+ ++this.size;
2434
+ data.push([key, value]);
2435
+ } else {
2436
+ data[index][1] = value;
2437
+ }
2438
+ return this;
2439
+ }
2440
+
2441
+ /**
2442
+ * Creates an list cache object.
2443
+ *
2444
+ * @private
2445
+ * @constructor
2446
+ * @param {Array} [entries] The key-value pairs to cache.
2447
+ */
2448
+ function ListCache(entries) {
2449
+ var index = -1,
2450
+ length = entries == null ? 0 : entries.length;
2451
+
2452
+ this.clear();
2453
+ while (++index < length) {
2454
+ var entry = entries[index];
2455
+ this.set(entry[0], entry[1]);
2456
+ }
2457
+ }
2458
+
2459
+ // Add methods to `ListCache`.
2460
+ ListCache.prototype.clear = listCacheClear;
2461
+ ListCache.prototype['delete'] = listCacheDelete;
2462
+ ListCache.prototype.get = listCacheGet;
2463
+ ListCache.prototype.has = listCacheHas;
2464
+ ListCache.prototype.set = listCacheSet;
2465
+
2466
+ /* Built-in method references that are verified to be native. */
2467
+ var Map = getNative(root, 'Map');
2468
+
2469
+ /**
2470
+ * Removes all key-value entries from the map.
2471
+ *
2472
+ * @private
2473
+ * @name clear
2474
+ * @memberOf MapCache
2475
+ */
2476
+ function mapCacheClear() {
2477
+ this.size = 0;
2478
+ this.__data__ = {
2479
+ 'hash': new Hash,
2480
+ 'map': new (Map || ListCache),
2481
+ 'string': new Hash
2482
+ };
2483
+ }
2484
+
2485
+ /**
2486
+ * Checks if `value` is suitable for use as unique object key.
2487
+ *
2488
+ * @private
2489
+ * @param {*} value The value to check.
2490
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
2491
+ */
2492
+ function isKeyable(value) {
2493
+ var type = typeof value;
2494
+ return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
2495
+ ? (value !== '__proto__')
2496
+ : (value === null);
2497
+ }
2498
+
2499
+ /**
2500
+ * Gets the data for `map`.
2501
+ *
2502
+ * @private
2503
+ * @param {Object} map The map to query.
2504
+ * @param {string} key The reference key.
2505
+ * @returns {*} Returns the map data.
2506
+ */
2507
+ function getMapData(map, key) {
2508
+ var data = map.__data__;
2509
+ return isKeyable(key)
2510
+ ? data[typeof key == 'string' ? 'string' : 'hash']
2511
+ : data.map;
2512
+ }
2513
+
2514
+ /**
2515
+ * Removes `key` and its value from the map.
2516
+ *
2517
+ * @private
2518
+ * @name delete
2519
+ * @memberOf MapCache
2520
+ * @param {string} key The key of the value to remove.
2521
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2522
+ */
2523
+ function mapCacheDelete(key) {
2524
+ var result = getMapData(this, key)['delete'](key);
2525
+ this.size -= result ? 1 : 0;
2526
+ return result;
2527
+ }
2528
+
2529
+ /**
2530
+ * Gets the map value for `key`.
2531
+ *
2532
+ * @private
2533
+ * @name get
2534
+ * @memberOf MapCache
2535
+ * @param {string} key The key of the value to get.
2536
+ * @returns {*} Returns the entry value.
2537
+ */
2538
+ function mapCacheGet(key) {
2539
+ return getMapData(this, key).get(key);
2540
+ }
2541
+
2542
+ /**
2543
+ * Checks if a map value for `key` exists.
2544
+ *
2545
+ * @private
2546
+ * @name has
2547
+ * @memberOf MapCache
2548
+ * @param {string} key The key of the entry to check.
2549
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2550
+ */
2551
+ function mapCacheHas(key) {
2552
+ return getMapData(this, key).has(key);
2553
+ }
2554
+
2555
+ /**
2556
+ * Sets the map `key` to `value`.
2557
+ *
2558
+ * @private
2559
+ * @name set
2560
+ * @memberOf MapCache
2561
+ * @param {string} key The key of the value to set.
2562
+ * @param {*} value The value to set.
2563
+ * @returns {Object} Returns the map cache instance.
2564
+ */
2565
+ function mapCacheSet(key, value) {
2566
+ var data = getMapData(this, key),
2567
+ size = data.size;
2568
+
2569
+ data.set(key, value);
2570
+ this.size += data.size == size ? 0 : 1;
2571
+ return this;
2572
+ }
2573
+
2574
+ /**
2575
+ * Creates a map cache object to store key-value pairs.
2576
+ *
2577
+ * @private
2578
+ * @constructor
2579
+ * @param {Array} [entries] The key-value pairs to cache.
2580
+ */
2581
+ function MapCache(entries) {
2582
+ var index = -1,
2583
+ length = entries == null ? 0 : entries.length;
2584
+
2585
+ this.clear();
2586
+ while (++index < length) {
2587
+ var entry = entries[index];
2588
+ this.set(entry[0], entry[1]);
2589
+ }
2590
+ }
2591
+
2592
+ // Add methods to `MapCache`.
2593
+ MapCache.prototype.clear = mapCacheClear;
2594
+ MapCache.prototype['delete'] = mapCacheDelete;
2595
+ MapCache.prototype.get = mapCacheGet;
2596
+ MapCache.prototype.has = mapCacheHas;
2597
+ MapCache.prototype.set = mapCacheSet;
2598
+
2599
+ /** Error message constants. */
2600
+ var FUNC_ERROR_TEXT = 'Expected a function';
2601
+
2602
+ /**
2603
+ * Creates a function that memoizes the result of `func`. If `resolver` is
2604
+ * provided, it determines the cache key for storing the result based on the
2605
+ * arguments provided to the memoized function. By default, the first argument
2606
+ * provided to the memoized function is used as the map cache key. The `func`
2607
+ * is invoked with the `this` binding of the memoized function.
2608
+ *
2609
+ * **Note:** The cache is exposed as the `cache` property on the memoized
2610
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
2611
+ * constructor with one whose instances implement the
2612
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
2613
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
2614
+ *
2615
+ * @static
2616
+ * @memberOf _
2617
+ * @since 0.1.0
2618
+ * @category Function
2619
+ * @param {Function} func The function to have its output memoized.
2620
+ * @param {Function} [resolver] The function to resolve the cache key.
2621
+ * @returns {Function} Returns the new memoized function.
2622
+ * @example
2623
+ *
2624
+ * var object = { 'a': 1, 'b': 2 };
2625
+ * var other = { 'c': 3, 'd': 4 };
2626
+ *
2627
+ * var values = _.memoize(_.values);
2628
+ * values(object);
2629
+ * // => [1, 2]
2630
+ *
2631
+ * values(other);
2632
+ * // => [3, 4]
2633
+ *
2634
+ * object.a = 2;
2635
+ * values(object);
2636
+ * // => [1, 2]
2637
+ *
2638
+ * // Modify the result cache.
2639
+ * values.cache.set(object, ['a', 'b']);
2640
+ * values(object);
2641
+ * // => ['a', 'b']
2642
+ *
2643
+ * // Replace `_.memoize.Cache`.
2644
+ * _.memoize.Cache = WeakMap;
2645
+ */
2646
+ function memoize(func, resolver) {
2647
+ if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
2648
+ throw new TypeError(FUNC_ERROR_TEXT);
2649
+ }
2650
+ var memoized = function() {
2651
+ var args = arguments,
2652
+ key = resolver ? resolver.apply(this, args) : args[0],
2653
+ cache = memoized.cache;
2654
+
2655
+ if (cache.has(key)) {
2656
+ return cache.get(key);
2657
+ }
2658
+ var result = func.apply(this, args);
2659
+ memoized.cache = cache.set(key, result) || cache;
2660
+ return result;
2661
+ };
2662
+ memoized.cache = new (memoize.Cache || MapCache);
2663
+ return memoized;
2664
+ }
2665
+
2666
+ // Expose `MapCache`.
2667
+ memoize.Cache = MapCache;
2668
+
2669
+ /** Used as the maximum memoize cache size. */
2670
+ var MAX_MEMOIZE_SIZE = 500;
2671
+
2672
+ /**
2673
+ * A specialized version of `_.memoize` which clears the memoized function's
2674
+ * cache when it exceeds `MAX_MEMOIZE_SIZE`.
2675
+ *
2676
+ * @private
2677
+ * @param {Function} func The function to have its output memoized.
2678
+ * @returns {Function} Returns the new memoized function.
2679
+ */
2680
+ function memoizeCapped(func) {
2681
+ var result = memoize(func, function(key) {
2682
+ if (cache.size === MAX_MEMOIZE_SIZE) {
2683
+ cache.clear();
2684
+ }
2685
+ return key;
2686
+ });
2687
+
2688
+ var cache = result.cache;
2689
+ return result;
2690
+ }
2691
+
2692
+ /** Used to match property names within property paths. */
2693
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
2694
+
2695
+ /** Used to match backslashes in property paths. */
2696
+ var reEscapeChar = /\\(\\)?/g;
2697
+
2698
+ /**
2699
+ * Converts `string` to a property path array.
2700
+ *
2701
+ * @private
2702
+ * @param {string} string The string to convert.
2703
+ * @returns {Array} Returns the property path array.
2704
+ */
2705
+ var stringToPath = memoizeCapped(function(string) {
2706
+ var result = [];
2707
+ if (string.charCodeAt(0) === 46 /* . */) {
2708
+ result.push('');
2709
+ }
2710
+ string.replace(rePropName, function(match, number, quote, subString) {
2711
+ result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
2712
+ });
2713
+ return result;
2714
+ });
2715
+
2716
+ /**
2717
+ * Converts `value` to a string. An empty string is returned for `null`
2718
+ * and `undefined` values. The sign of `-0` is preserved.
2719
+ *
2720
+ * @static
2721
+ * @memberOf _
2722
+ * @since 4.0.0
2723
+ * @category Lang
2724
+ * @param {*} value The value to convert.
2725
+ * @returns {string} Returns the converted string.
2726
+ * @example
2727
+ *
2728
+ * _.toString(null);
2729
+ * // => ''
2730
+ *
2731
+ * _.toString(-0);
2732
+ * // => '-0'
2733
+ *
2734
+ * _.toString([1, 2, 3]);
2735
+ * // => '1,2,3'
2736
+ */
2737
+ function toString(value) {
2738
+ return value == null ? '' : baseToString(value);
2739
+ }
2740
+
2741
+ /**
2742
+ * Casts `value` to a path array if it's not one.
2743
+ *
2744
+ * @private
2745
+ * @param {*} value The value to inspect.
2746
+ * @param {Object} [object] The object to query keys on.
2747
+ * @returns {Array} Returns the cast property path array.
2748
+ */
2749
+ function castPath(value, object) {
2750
+ if (isArray(value)) {
2751
+ return value;
2752
+ }
2753
+ return isKey(value, object) ? [value] : stringToPath(toString(value));
2754
+ }
2755
+
2756
+ /** Used as references for various `Number` constants. */
2757
+ var INFINITY = 1 / 0;
2758
+
2759
+ /**
2760
+ * Converts `value` to a string key if it's not a string or symbol.
2761
+ *
2762
+ * @private
2763
+ * @param {*} value The value to inspect.
2764
+ * @returns {string|symbol} Returns the key.
2765
+ */
2766
+ function toKey(value) {
2767
+ if (typeof value == 'string' || isSymbol(value)) {
2768
+ return value;
2769
+ }
2770
+ var result = (value + '');
2771
+ return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
2772
+ }
2773
+
2774
+ /**
2775
+ * The base implementation of `_.get` without support for default values.
2776
+ *
2777
+ * @private
2778
+ * @param {Object} object The object to query.
2779
+ * @param {Array|string} path The path of the property to get.
2780
+ * @returns {*} Returns the resolved value.
2781
+ */
2782
+ function baseGet(object, path) {
2783
+ path = castPath(path, object);
2784
+
2785
+ var index = 0,
2786
+ length = path.length;
2787
+
2788
+ while (object != null && index < length) {
2789
+ object = object[toKey(path[index++])];
2790
+ }
2791
+ return (index && index == length) ? object : undefined;
2792
+ }
2793
+
2794
+ /**
2795
+ * Gets the value at `path` of `object`. If the resolved value is
2796
+ * `undefined`, the `defaultValue` is returned in its place.
2797
+ *
2798
+ * @static
2799
+ * @memberOf _
2800
+ * @since 3.7.0
2801
+ * @category Object
2802
+ * @param {Object} object The object to query.
2803
+ * @param {Array|string} path The path of the property to get.
2804
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
2805
+ * @returns {*} Returns the resolved value.
2806
+ * @example
2807
+ *
2808
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
2809
+ *
2810
+ * _.get(object, 'a[0].b.c');
2811
+ * // => 3
2812
+ *
2813
+ * _.get(object, ['a', '0', 'b', 'c']);
2814
+ * // => 3
2815
+ *
2816
+ * _.get(object, 'a.b.c', 'default');
2817
+ * // => 'default'
2818
+ */
2819
+ function get(object, path, defaultValue) {
2820
+ var result = object == null ? undefined : baseGet(object, path);
2821
+ return result === undefined ? defaultValue : result;
2822
+ }
2823
+
2824
+ /**
2825
+ * Appends the elements of `values` to `array`.
2826
+ *
2827
+ * @private
2828
+ * @param {Array} array The array to modify.
2829
+ * @param {Array} values The values to append.
2830
+ * @returns {Array} Returns `array`.
2831
+ */
2832
+ function arrayPush(array, values) {
2833
+ var index = -1,
2834
+ length = values.length,
2835
+ offset = array.length;
2836
+
2837
+ while (++index < length) {
2838
+ array[offset + index] = values[index];
2839
+ }
2840
+ return array;
2841
+ }
2842
+
2843
+ /**
2844
+ * Removes all key-value entries from the stack.
2845
+ *
2846
+ * @private
2847
+ * @name clear
2848
+ * @memberOf Stack
2849
+ */
2850
+ function stackClear() {
2851
+ this.__data__ = new ListCache;
2852
+ this.size = 0;
2853
+ }
2854
+
2855
+ /**
2856
+ * Removes `key` and its value from the stack.
2857
+ *
2858
+ * @private
2859
+ * @name delete
2860
+ * @memberOf Stack
2861
+ * @param {string} key The key of the value to remove.
2862
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2863
+ */
2864
+ function stackDelete(key) {
2865
+ var data = this.__data__,
2866
+ result = data['delete'](key);
2867
+
2868
+ this.size = data.size;
2869
+ return result;
2870
+ }
2871
+
2872
+ /**
2873
+ * Gets the stack value for `key`.
2874
+ *
2875
+ * @private
2876
+ * @name get
2877
+ * @memberOf Stack
2878
+ * @param {string} key The key of the value to get.
2879
+ * @returns {*} Returns the entry value.
2880
+ */
2881
+ function stackGet(key) {
2882
+ return this.__data__.get(key);
2883
+ }
2884
+
2885
+ /**
2886
+ * Checks if a stack value for `key` exists.
2887
+ *
2888
+ * @private
2889
+ * @name has
2890
+ * @memberOf Stack
2891
+ * @param {string} key The key of the entry to check.
2892
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2893
+ */
2894
+ function stackHas(key) {
2895
+ return this.__data__.has(key);
2896
+ }
2897
+
2898
+ /** Used as the size to enable large array optimizations. */
2899
+ var LARGE_ARRAY_SIZE = 200;
2900
+
2901
+ /**
2902
+ * Sets the stack `key` to `value`.
2903
+ *
2904
+ * @private
2905
+ * @name set
2906
+ * @memberOf Stack
2907
+ * @param {string} key The key of the value to set.
2908
+ * @param {*} value The value to set.
2909
+ * @returns {Object} Returns the stack cache instance.
2910
+ */
2911
+ function stackSet(key, value) {
2912
+ var data = this.__data__;
2913
+ if (data instanceof ListCache) {
2914
+ var pairs = data.__data__;
2915
+ if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
2916
+ pairs.push([key, value]);
2917
+ this.size = ++data.size;
2918
+ return this;
2919
+ }
2920
+ data = this.__data__ = new MapCache(pairs);
2921
+ }
2922
+ data.set(key, value);
2923
+ this.size = data.size;
2924
+ return this;
2925
+ }
2926
+
2927
+ /**
2928
+ * Creates a stack cache object to store key-value pairs.
2929
+ *
2930
+ * @private
2931
+ * @constructor
2932
+ * @param {Array} [entries] The key-value pairs to cache.
2933
+ */
2934
+ function Stack(entries) {
2935
+ var data = this.__data__ = new ListCache(entries);
2936
+ this.size = data.size;
2937
+ }
2938
+
2939
+ // Add methods to `Stack`.
2940
+ Stack.prototype.clear = stackClear;
2941
+ Stack.prototype['delete'] = stackDelete;
2942
+ Stack.prototype.get = stackGet;
2943
+ Stack.prototype.has = stackHas;
2944
+ Stack.prototype.set = stackSet;
2945
+
2946
+ /**
2947
+ * A specialized version of `_.filter` for arrays without support for
2948
+ * iteratee shorthands.
2949
+ *
2950
+ * @private
2951
+ * @param {Array} [array] The array to iterate over.
2952
+ * @param {Function} predicate The function invoked per iteration.
2953
+ * @returns {Array} Returns the new filtered array.
2954
+ */
2955
+ function arrayFilter(array, predicate) {
2956
+ var index = -1,
2957
+ length = array == null ? 0 : array.length,
2958
+ resIndex = 0,
2959
+ result = [];
2960
+
2961
+ while (++index < length) {
2962
+ var value = array[index];
2963
+ if (predicate(value, index, array)) {
2964
+ result[resIndex++] = value;
2965
+ }
2966
+ }
2967
+ return result;
2968
+ }
2969
+
2970
+ /**
2971
+ * This method returns a new empty array.
2972
+ *
2973
+ * @static
2974
+ * @memberOf _
2975
+ * @since 4.13.0
2976
+ * @category Util
2977
+ * @returns {Array} Returns the new empty array.
2978
+ * @example
2979
+ *
2980
+ * var arrays = _.times(2, _.stubArray);
2981
+ *
2982
+ * console.log(arrays);
2983
+ * // => [[], []]
2984
+ *
2985
+ * console.log(arrays[0] === arrays[1]);
2986
+ * // => false
2987
+ */
2988
+ function stubArray() {
2989
+ return [];
2990
+ }
2991
+
2992
+ /** Used for built-in method references. */
2993
+ var objectProto$2 = Object.prototype;
2994
+
2995
+ /** Built-in value references. */
2996
+ var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
2997
+
2998
+ /* Built-in method references for those with the same name as other `lodash` methods. */
2999
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
3000
+
3001
+ /**
3002
+ * Creates an array of the own enumerable symbols of `object`.
3003
+ *
3004
+ * @private
3005
+ * @param {Object} object The object to query.
3006
+ * @returns {Array} Returns the array of symbols.
3007
+ */
3008
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
3009
+ if (object == null) {
3010
+ return [];
3011
+ }
3012
+ object = Object(object);
3013
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
3014
+ return propertyIsEnumerable.call(object, symbol);
3015
+ });
3016
+ };
3017
+
3018
+ /**
3019
+ * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
3020
+ * `keysFunc` and `symbolsFunc` to get the enumerable property names and
3021
+ * symbols of `object`.
3022
+ *
3023
+ * @private
3024
+ * @param {Object} object The object to query.
3025
+ * @param {Function} keysFunc The function to get the keys of `object`.
3026
+ * @param {Function} symbolsFunc The function to get the symbols of `object`.
3027
+ * @returns {Array} Returns the array of property names and symbols.
3028
+ */
3029
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
3030
+ var result = keysFunc(object);
3031
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
3032
+ }
3033
+
3034
+ /**
3035
+ * Creates an array of own enumerable property names and symbols of `object`.
3036
+ *
3037
+ * @private
3038
+ * @param {Object} object The object to query.
3039
+ * @returns {Array} Returns the array of property names and symbols.
3040
+ */
3041
+ function getAllKeys(object) {
3042
+ return baseGetAllKeys(object, keys, getSymbols);
3043
+ }
3044
+
3045
+ /* Built-in method references that are verified to be native. */
3046
+ var DataView = getNative(root, 'DataView');
3047
+
3048
+ /* Built-in method references that are verified to be native. */
3049
+ var Promise$1 = getNative(root, 'Promise');
3050
+
3051
+ /* Built-in method references that are verified to be native. */
3052
+ var Set = getNative(root, 'Set');
3053
+
3054
+ /** `Object#toString` result references. */
3055
+ var mapTag$1 = '[object Map]',
3056
+ objectTag$1 = '[object Object]',
3057
+ promiseTag = '[object Promise]',
3058
+ setTag$1 = '[object Set]',
3059
+ weakMapTag = '[object WeakMap]';
3060
+
3061
+ var dataViewTag$1 = '[object DataView]';
3062
+
3063
+ /** Used to detect maps, sets, and weakmaps. */
3064
+ var dataViewCtorString = toSource(DataView),
3065
+ mapCtorString = toSource(Map),
3066
+ promiseCtorString = toSource(Promise$1),
3067
+ setCtorString = toSource(Set),
3068
+ weakMapCtorString = toSource(WeakMap);
3069
+
3070
+ /**
3071
+ * Gets the `toStringTag` of `value`.
3072
+ *
3073
+ * @private
3074
+ * @param {*} value The value to query.
3075
+ * @returns {string} Returns the `toStringTag`.
3076
+ */
3077
+ var getTag = baseGetTag;
3078
+
3079
+ // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
3080
+ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$1) ||
3081
+ (Map && getTag(new Map) != mapTag$1) ||
3082
+ (Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
3083
+ (Set && getTag(new Set) != setTag$1) ||
3084
+ (WeakMap && getTag(new WeakMap) != weakMapTag)) {
3085
+ getTag = function(value) {
3086
+ var result = baseGetTag(value),
3087
+ Ctor = result == objectTag$1 ? value.constructor : undefined,
3088
+ ctorString = Ctor ? toSource(Ctor) : '';
3089
+
3090
+ if (ctorString) {
3091
+ switch (ctorString) {
3092
+ case dataViewCtorString: return dataViewTag$1;
3093
+ case mapCtorString: return mapTag$1;
3094
+ case promiseCtorString: return promiseTag;
3095
+ case setCtorString: return setTag$1;
3096
+ case weakMapCtorString: return weakMapTag;
3097
+ }
3098
+ }
3099
+ return result;
3100
+ };
3101
+ }
3102
+
3103
+ var getTag$1 = getTag;
3104
+
3105
+ /** Built-in value references. */
3106
+ var Uint8Array = root.Uint8Array;
3107
+
3108
+ /** Used to stand-in for `undefined` hash values. */
3109
+ var HASH_UNDEFINED = '__lodash_hash_undefined__';
3110
+
3111
+ /**
3112
+ * Adds `value` to the array cache.
3113
+ *
3114
+ * @private
3115
+ * @name add
3116
+ * @memberOf SetCache
3117
+ * @alias push
3118
+ * @param {*} value The value to cache.
3119
+ * @returns {Object} Returns the cache instance.
3120
+ */
3121
+ function setCacheAdd(value) {
3122
+ this.__data__.set(value, HASH_UNDEFINED);
3123
+ return this;
3124
+ }
3125
+
3126
+ /**
3127
+ * Checks if `value` is in the array cache.
3128
+ *
3129
+ * @private
3130
+ * @name has
3131
+ * @memberOf SetCache
3132
+ * @param {*} value The value to search for.
3133
+ * @returns {number} Returns `true` if `value` is found, else `false`.
3134
+ */
3135
+ function setCacheHas(value) {
3136
+ return this.__data__.has(value);
3137
+ }
3138
+
3139
+ /**
3140
+ *
3141
+ * Creates an array cache object to store unique values.
3142
+ *
3143
+ * @private
3144
+ * @constructor
3145
+ * @param {Array} [values] The values to cache.
3146
+ */
3147
+ function SetCache(values) {
3148
+ var index = -1,
3149
+ length = values == null ? 0 : values.length;
3150
+
3151
+ this.__data__ = new MapCache;
3152
+ while (++index < length) {
3153
+ this.add(values[index]);
3154
+ }
3155
+ }
3156
+
3157
+ // Add methods to `SetCache`.
3158
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
3159
+ SetCache.prototype.has = setCacheHas;
3160
+
3161
+ /**
3162
+ * A specialized version of `_.some` for arrays without support for iteratee
3163
+ * shorthands.
3164
+ *
3165
+ * @private
3166
+ * @param {Array} [array] The array to iterate over.
3167
+ * @param {Function} predicate The function invoked per iteration.
3168
+ * @returns {boolean} Returns `true` if any element passes the predicate check,
3169
+ * else `false`.
3170
+ */
3171
+ function arraySome(array, predicate) {
3172
+ var index = -1,
3173
+ length = array == null ? 0 : array.length;
3174
+
3175
+ while (++index < length) {
3176
+ if (predicate(array[index], index, array)) {
3177
+ return true;
3178
+ }
3179
+ }
3180
+ return false;
3181
+ }
3182
+
3183
+ /**
3184
+ * Checks if a `cache` value for `key` exists.
3185
+ *
3186
+ * @private
3187
+ * @param {Object} cache The cache to query.
3188
+ * @param {string} key The key of the entry to check.
3189
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
3190
+ */
3191
+ function cacheHas(cache, key) {
3192
+ return cache.has(key);
3193
+ }
3194
+
3195
+ /** Used to compose bitmasks for value comparisons. */
3196
+ var COMPARE_PARTIAL_FLAG$5 = 1,
3197
+ COMPARE_UNORDERED_FLAG$3 = 2;
3198
+
3199
+ /**
3200
+ * A specialized version of `baseIsEqualDeep` for arrays with support for
3201
+ * partial deep comparisons.
3202
+ *
3203
+ * @private
3204
+ * @param {Array} array The array to compare.
3205
+ * @param {Array} other The other array to compare.
3206
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3207
+ * @param {Function} customizer The function to customize comparisons.
3208
+ * @param {Function} equalFunc The function to determine equivalents of values.
3209
+ * @param {Object} stack Tracks traversed `array` and `other` objects.
3210
+ * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
3211
+ */
3212
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
3213
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
3214
+ arrLength = array.length,
3215
+ othLength = other.length;
3216
+
3217
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
3218
+ return false;
3219
+ }
3220
+ // Check that cyclic values are equal.
3221
+ var arrStacked = stack.get(array);
3222
+ var othStacked = stack.get(other);
3223
+ if (arrStacked && othStacked) {
3224
+ return arrStacked == other && othStacked == array;
3225
+ }
3226
+ var index = -1,
3227
+ result = true,
3228
+ seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new SetCache : undefined;
3229
+
3230
+ stack.set(array, other);
3231
+ stack.set(other, array);
3232
+
3233
+ // Ignore non-index properties.
3234
+ while (++index < arrLength) {
3235
+ var arrValue = array[index],
3236
+ othValue = other[index];
3237
+
3238
+ if (customizer) {
3239
+ var compared = isPartial
3240
+ ? customizer(othValue, arrValue, index, other, array, stack)
3241
+ : customizer(arrValue, othValue, index, array, other, stack);
3242
+ }
3243
+ if (compared !== undefined) {
3244
+ if (compared) {
3245
+ continue;
3246
+ }
3247
+ result = false;
3248
+ break;
3249
+ }
3250
+ // Recursively compare arrays (susceptible to call stack limits).
3251
+ if (seen) {
3252
+ if (!arraySome(other, function(othValue, othIndex) {
3253
+ if (!cacheHas(seen, othIndex) &&
3254
+ (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
3255
+ return seen.push(othIndex);
3256
+ }
3257
+ })) {
3258
+ result = false;
3259
+ break;
3260
+ }
3261
+ } else if (!(
3262
+ arrValue === othValue ||
3263
+ equalFunc(arrValue, othValue, bitmask, customizer, stack)
3264
+ )) {
3265
+ result = false;
3266
+ break;
3267
+ }
3268
+ }
3269
+ stack['delete'](array);
3270
+ stack['delete'](other);
3271
+ return result;
3272
+ }
3273
+
3274
+ /**
3275
+ * Converts `map` to its key-value pairs.
3276
+ *
3277
+ * @private
3278
+ * @param {Object} map The map to convert.
3279
+ * @returns {Array} Returns the key-value pairs.
3280
+ */
3281
+ function mapToArray(map) {
3282
+ var index = -1,
3283
+ result = Array(map.size);
3284
+
3285
+ map.forEach(function(value, key) {
3286
+ result[++index] = [key, value];
3287
+ });
3288
+ return result;
3289
+ }
3290
+
3291
+ /**
3292
+ * Converts `set` to an array of its values.
3293
+ *
3294
+ * @private
3295
+ * @param {Object} set The set to convert.
3296
+ * @returns {Array} Returns the values.
3297
+ */
3298
+ function setToArray(set) {
3299
+ var index = -1,
3300
+ result = Array(set.size);
3301
+
3302
+ set.forEach(function(value) {
3303
+ result[++index] = value;
3304
+ });
3305
+ return result;
3306
+ }
3307
+
3308
+ /** Used to compose bitmasks for value comparisons. */
3309
+ var COMPARE_PARTIAL_FLAG$4 = 1,
3310
+ COMPARE_UNORDERED_FLAG$2 = 2;
3311
+
3312
+ /** `Object#toString` result references. */
3313
+ var boolTag = '[object Boolean]',
3314
+ dateTag = '[object Date]',
3315
+ errorTag = '[object Error]',
3316
+ mapTag = '[object Map]',
3317
+ numberTag = '[object Number]',
3318
+ regexpTag = '[object RegExp]',
3319
+ setTag = '[object Set]',
3320
+ stringTag = '[object String]',
3321
+ symbolTag = '[object Symbol]';
3322
+
3323
+ var arrayBufferTag = '[object ArrayBuffer]',
3324
+ dataViewTag = '[object DataView]';
3325
+
3326
+ /** Used to convert symbols to primitives and strings. */
3327
+ var symbolProto = Symbol ? Symbol.prototype : undefined,
3328
+ symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
3329
+
3330
+ /**
3331
+ * A specialized version of `baseIsEqualDeep` for comparing objects of
3332
+ * the same `toStringTag`.
3333
+ *
3334
+ * **Note:** This function only supports comparing values with tags of
3335
+ * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
3336
+ *
3337
+ * @private
3338
+ * @param {Object} object The object to compare.
3339
+ * @param {Object} other The other object to compare.
3340
+ * @param {string} tag The `toStringTag` of the objects to compare.
3341
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3342
+ * @param {Function} customizer The function to customize comparisons.
3343
+ * @param {Function} equalFunc The function to determine equivalents of values.
3344
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
3345
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3346
+ */
3347
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
3348
+ switch (tag) {
3349
+ case dataViewTag:
3350
+ if ((object.byteLength != other.byteLength) ||
3351
+ (object.byteOffset != other.byteOffset)) {
3352
+ return false;
3353
+ }
3354
+ object = object.buffer;
3355
+ other = other.buffer;
3356
+
3357
+ case arrayBufferTag:
3358
+ if ((object.byteLength != other.byteLength) ||
3359
+ !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
3360
+ return false;
3361
+ }
3362
+ return true;
3363
+
3364
+ case boolTag:
3365
+ case dateTag:
3366
+ case numberTag:
3367
+ // Coerce booleans to `1` or `0` and dates to milliseconds.
3368
+ // Invalid dates are coerced to `NaN`.
3369
+ return eq(+object, +other);
3370
+
3371
+ case errorTag:
3372
+ return object.name == other.name && object.message == other.message;
3373
+
3374
+ case regexpTag:
3375
+ case stringTag:
3376
+ // Coerce regexes to strings and treat strings, primitives and objects,
3377
+ // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
3378
+ // for more details.
3379
+ return object == (other + '');
3380
+
3381
+ case mapTag:
3382
+ var convert = mapToArray;
3383
+
3384
+ case setTag:
3385
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
3386
+ convert || (convert = setToArray);
3387
+
3388
+ if (object.size != other.size && !isPartial) {
3389
+ return false;
3390
+ }
3391
+ // Assume cyclic values are equal.
3392
+ var stacked = stack.get(object);
3393
+ if (stacked) {
3394
+ return stacked == other;
3395
+ }
3396
+ bitmask |= COMPARE_UNORDERED_FLAG$2;
3397
+
3398
+ // Recursively compare objects (susceptible to call stack limits).
3399
+ stack.set(object, other);
3400
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
3401
+ stack['delete'](object);
3402
+ return result;
3403
+
3404
+ case symbolTag:
3405
+ if (symbolValueOf) {
3406
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
3407
+ }
3408
+ }
3409
+ return false;
3410
+ }
3411
+
3412
+ /** Used to compose bitmasks for value comparisons. */
3413
+ var COMPARE_PARTIAL_FLAG$3 = 1;
3414
+
3415
+ /** Used for built-in method references. */
3416
+ var objectProto$1 = Object.prototype;
3417
+
3418
+ /** Used to check objects for own properties. */
3419
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
3420
+
3421
+ /**
3422
+ * A specialized version of `baseIsEqualDeep` for objects with support for
3423
+ * partial deep comparisons.
3424
+ *
3425
+ * @private
3426
+ * @param {Object} object The object to compare.
3427
+ * @param {Object} other The other object to compare.
3428
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3429
+ * @param {Function} customizer The function to customize comparisons.
3430
+ * @param {Function} equalFunc The function to determine equivalents of values.
3431
+ * @param {Object} stack Tracks traversed `object` and `other` objects.
3432
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3433
+ */
3434
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
3435
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
3436
+ objProps = getAllKeys(object),
3437
+ objLength = objProps.length,
3438
+ othProps = getAllKeys(other),
3439
+ othLength = othProps.length;
3440
+
3441
+ if (objLength != othLength && !isPartial) {
3442
+ return false;
3443
+ }
3444
+ var index = objLength;
3445
+ while (index--) {
3446
+ var key = objProps[index];
3447
+ if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
3448
+ return false;
3449
+ }
3450
+ }
3451
+ // Check that cyclic values are equal.
3452
+ var objStacked = stack.get(object);
3453
+ var othStacked = stack.get(other);
3454
+ if (objStacked && othStacked) {
3455
+ return objStacked == other && othStacked == object;
3456
+ }
3457
+ var result = true;
3458
+ stack.set(object, other);
3459
+ stack.set(other, object);
3460
+
3461
+ var skipCtor = isPartial;
3462
+ while (++index < objLength) {
3463
+ key = objProps[index];
3464
+ var objValue = object[key],
3465
+ othValue = other[key];
3466
+
3467
+ if (customizer) {
3468
+ var compared = isPartial
3469
+ ? customizer(othValue, objValue, key, other, object, stack)
3470
+ : customizer(objValue, othValue, key, object, other, stack);
3471
+ }
3472
+ // Recursively compare objects (susceptible to call stack limits).
3473
+ if (!(compared === undefined
3474
+ ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
3475
+ : compared
3476
+ )) {
3477
+ result = false;
3478
+ break;
3479
+ }
3480
+ skipCtor || (skipCtor = key == 'constructor');
3481
+ }
3482
+ if (result && !skipCtor) {
3483
+ var objCtor = object.constructor,
3484
+ othCtor = other.constructor;
3485
+
3486
+ // Non `Object` object instances with different constructors are not equal.
3487
+ if (objCtor != othCtor &&
3488
+ ('constructor' in object && 'constructor' in other) &&
3489
+ !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
3490
+ typeof othCtor == 'function' && othCtor instanceof othCtor)) {
3491
+ result = false;
3492
+ }
3493
+ }
3494
+ stack['delete'](object);
3495
+ stack['delete'](other);
3496
+ return result;
3497
+ }
3498
+
3499
+ /** Used to compose bitmasks for value comparisons. */
3500
+ var COMPARE_PARTIAL_FLAG$2 = 1;
3501
+
3502
+ /** `Object#toString` result references. */
3503
+ var argsTag = '[object Arguments]',
3504
+ arrayTag = '[object Array]',
3505
+ objectTag = '[object Object]';
3506
+
3507
+ /** Used for built-in method references. */
3508
+ var objectProto = Object.prototype;
3509
+
3510
+ /** Used to check objects for own properties. */
3511
+ var hasOwnProperty = objectProto.hasOwnProperty;
3512
+
3513
+ /**
3514
+ * A specialized version of `baseIsEqual` for arrays and objects which performs
3515
+ * deep comparisons and tracks traversed objects enabling objects with circular
3516
+ * references to be compared.
3517
+ *
3518
+ * @private
3519
+ * @param {Object} object The object to compare.
3520
+ * @param {Object} other The other object to compare.
3521
+ * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
3522
+ * @param {Function} customizer The function to customize comparisons.
3523
+ * @param {Function} equalFunc The function to determine equivalents of values.
3524
+ * @param {Object} [stack] Tracks traversed `object` and `other` objects.
3525
+ * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
3526
+ */
3527
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
3528
+ var objIsArr = isArray(object),
3529
+ othIsArr = isArray(other),
3530
+ objTag = objIsArr ? arrayTag : getTag$1(object),
3531
+ othTag = othIsArr ? arrayTag : getTag$1(other);
3532
+
3533
+ objTag = objTag == argsTag ? objectTag : objTag;
3534
+ othTag = othTag == argsTag ? objectTag : othTag;
3535
+
3536
+ var objIsObj = objTag == objectTag,
3537
+ othIsObj = othTag == objectTag,
3538
+ isSameTag = objTag == othTag;
3539
+
3540
+ if (isSameTag && isBuffer(object)) {
3541
+ if (!isBuffer(other)) {
3542
+ return false;
3543
+ }
3544
+ objIsArr = true;
3545
+ objIsObj = false;
3546
+ }
3547
+ if (isSameTag && !objIsObj) {
3548
+ stack || (stack = new Stack);
3549
+ return (objIsArr || isTypedArray(object))
3550
+ ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
3551
+ : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
3552
+ }
3553
+ if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
3554
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
3555
+ othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
3556
+
3557
+ if (objIsWrapped || othIsWrapped) {
3558
+ var objUnwrapped = objIsWrapped ? object.value() : object,
3559
+ othUnwrapped = othIsWrapped ? other.value() : other;
3560
+
3561
+ stack || (stack = new Stack);
3562
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
3563
+ }
3564
+ }
3565
+ if (!isSameTag) {
3566
+ return false;
3567
+ }
3568
+ stack || (stack = new Stack);
3569
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
3570
+ }
3571
+
3572
+ /**
3573
+ * The base implementation of `_.isEqual` which supports partial comparisons
3574
+ * and tracks traversed objects.
3575
+ *
3576
+ * @private
3577
+ * @param {*} value The value to compare.
3578
+ * @param {*} other The other value to compare.
3579
+ * @param {boolean} bitmask The bitmask flags.
3580
+ * 1 - Unordered comparison
3581
+ * 2 - Partial comparison
3582
+ * @param {Function} [customizer] The function to customize comparisons.
3583
+ * @param {Object} [stack] Tracks traversed `value` and `other` objects.
3584
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
3585
+ */
3586
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
3587
+ if (value === other) {
3588
+ return true;
3589
+ }
3590
+ if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
3591
+ return value !== value && other !== other;
3592
+ }
3593
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
3594
+ }
3595
+
3596
+ /** Used to compose bitmasks for value comparisons. */
3597
+ var COMPARE_PARTIAL_FLAG$1 = 1,
3598
+ COMPARE_UNORDERED_FLAG$1 = 2;
3599
+
3600
+ /**
3601
+ * The base implementation of `_.isMatch` without support for iteratee shorthands.
3602
+ *
3603
+ * @private
3604
+ * @param {Object} object The object to inspect.
3605
+ * @param {Object} source The object of property values to match.
3606
+ * @param {Array} matchData The property names, values, and compare flags to match.
3607
+ * @param {Function} [customizer] The function to customize comparisons.
3608
+ * @returns {boolean} Returns `true` if `object` is a match, else `false`.
3609
+ */
3610
+ function baseIsMatch(object, source, matchData, customizer) {
3611
+ var index = matchData.length,
3612
+ length = index,
3613
+ noCustomizer = !customizer;
3614
+
3615
+ if (object == null) {
3616
+ return !length;
3617
+ }
3618
+ object = Object(object);
3619
+ while (index--) {
3620
+ var data = matchData[index];
3621
+ if ((noCustomizer && data[2])
3622
+ ? data[1] !== object[data[0]]
3623
+ : !(data[0] in object)
3624
+ ) {
3625
+ return false;
3626
+ }
3627
+ }
3628
+ while (++index < length) {
3629
+ data = matchData[index];
3630
+ var key = data[0],
3631
+ objValue = object[key],
3632
+ srcValue = data[1];
3633
+
3634
+ if (noCustomizer && data[2]) {
3635
+ if (objValue === undefined && !(key in object)) {
3636
+ return false;
3637
+ }
3638
+ } else {
3639
+ var stack = new Stack;
3640
+ if (customizer) {
3641
+ var result = customizer(objValue, srcValue, key, object, source, stack);
3642
+ }
3643
+ if (!(result === undefined
3644
+ ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
3645
+ : result
3646
+ )) {
3647
+ return false;
3648
+ }
3649
+ }
3650
+ }
3651
+ return true;
3652
+ }
3653
+
3654
+ /**
3655
+ * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
3656
+ *
3657
+ * @private
3658
+ * @param {*} value The value to check.
3659
+ * @returns {boolean} Returns `true` if `value` if suitable for strict
3660
+ * equality comparisons, else `false`.
3661
+ */
3662
+ function isStrictComparable(value) {
3663
+ return value === value && !isObject(value);
3664
+ }
3665
+
3666
+ /**
3667
+ * Gets the property names, values, and compare flags of `object`.
3668
+ *
3669
+ * @private
3670
+ * @param {Object} object The object to query.
3671
+ * @returns {Array} Returns the match data of `object`.
3672
+ */
3673
+ function getMatchData(object) {
3674
+ var result = keys(object),
3675
+ length = result.length;
3676
+
3677
+ while (length--) {
3678
+ var key = result[length],
3679
+ value = object[key];
3680
+
3681
+ result[length] = [key, value, isStrictComparable(value)];
3682
+ }
3683
+ return result;
3684
+ }
3685
+
3686
+ /**
3687
+ * A specialized version of `matchesProperty` for source values suitable
3688
+ * for strict equality comparisons, i.e. `===`.
3689
+ *
3690
+ * @private
3691
+ * @param {string} key The key of the property to get.
3692
+ * @param {*} srcValue The value to match.
3693
+ * @returns {Function} Returns the new spec function.
3694
+ */
3695
+ function matchesStrictComparable(key, srcValue) {
3696
+ return function(object) {
3697
+ if (object == null) {
3698
+ return false;
3699
+ }
3700
+ return object[key] === srcValue &&
3701
+ (srcValue !== undefined || (key in Object(object)));
3702
+ };
3703
+ }
3704
+
3705
+ /**
3706
+ * The base implementation of `_.matches` which doesn't clone `source`.
3707
+ *
3708
+ * @private
3709
+ * @param {Object} source The object of property values to match.
3710
+ * @returns {Function} Returns the new spec function.
3711
+ */
3712
+ function baseMatches(source) {
3713
+ var matchData = getMatchData(source);
3714
+ if (matchData.length == 1 && matchData[0][2]) {
3715
+ return matchesStrictComparable(matchData[0][0], matchData[0][1]);
3716
+ }
3717
+ return function(object) {
3718
+ return object === source || baseIsMatch(object, source, matchData);
3719
+ };
3720
+ }
3721
+
3722
+ /**
3723
+ * The base implementation of `_.hasIn` without support for deep paths.
3724
+ *
3725
+ * @private
3726
+ * @param {Object} [object] The object to query.
3727
+ * @param {Array|string} key The key to check.
3728
+ * @returns {boolean} Returns `true` if `key` exists, else `false`.
3729
+ */
3730
+ function baseHasIn(object, key) {
3731
+ return object != null && key in Object(object);
3732
+ }
3733
+
3734
+ /**
3735
+ * Checks if `path` exists on `object`.
3736
+ *
3737
+ * @private
3738
+ * @param {Object} object The object to query.
3739
+ * @param {Array|string} path The path to check.
3740
+ * @param {Function} hasFunc The function to check properties.
3741
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
3742
+ */
3743
+ function hasPath(object, path, hasFunc) {
3744
+ path = castPath(path, object);
3745
+
3746
+ var index = -1,
3747
+ length = path.length,
3748
+ result = false;
3749
+
3750
+ while (++index < length) {
3751
+ var key = toKey(path[index]);
3752
+ if (!(result = object != null && hasFunc(object, key))) {
3753
+ break;
3754
+ }
3755
+ object = object[key];
3756
+ }
3757
+ if (result || ++index != length) {
3758
+ return result;
3759
+ }
3760
+ length = object == null ? 0 : object.length;
3761
+ return !!length && isLength(length) && isIndex(key, length) &&
3762
+ (isArray(object) || isArguments(object));
3763
+ }
3764
+
3765
+ /**
3766
+ * Checks if `path` is a direct or inherited property of `object`.
3767
+ *
3768
+ * @static
3769
+ * @memberOf _
3770
+ * @since 4.0.0
3771
+ * @category Object
3772
+ * @param {Object} object The object to query.
3773
+ * @param {Array|string} path The path to check.
3774
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
3775
+ * @example
3776
+ *
3777
+ * var object = _.create({ 'a': _.create({ 'b': 2 }) });
3778
+ *
3779
+ * _.hasIn(object, 'a');
3780
+ * // => true
3781
+ *
3782
+ * _.hasIn(object, 'a.b');
3783
+ * // => true
3784
+ *
3785
+ * _.hasIn(object, ['a', 'b']);
3786
+ * // => true
3787
+ *
3788
+ * _.hasIn(object, 'b');
3789
+ * // => false
3790
+ */
3791
+ function hasIn(object, path) {
3792
+ return object != null && hasPath(object, path, baseHasIn);
3793
+ }
3794
+
3795
+ /** Used to compose bitmasks for value comparisons. */
3796
+ var COMPARE_PARTIAL_FLAG = 1,
3797
+ COMPARE_UNORDERED_FLAG = 2;
3798
+
3799
+ /**
3800
+ * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
3801
+ *
3802
+ * @private
3803
+ * @param {string} path The path of the property to get.
3804
+ * @param {*} srcValue The value to match.
3805
+ * @returns {Function} Returns the new spec function.
3806
+ */
3807
+ function baseMatchesProperty(path, srcValue) {
3808
+ if (isKey(path) && isStrictComparable(srcValue)) {
3809
+ return matchesStrictComparable(toKey(path), srcValue);
3810
+ }
3811
+ return function(object) {
3812
+ var objValue = get(object, path);
3813
+ return (objValue === undefined && objValue === srcValue)
3814
+ ? hasIn(object, path)
3815
+ : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
3816
+ };
3817
+ }
3818
+
3819
+ /**
3820
+ * The base implementation of `_.property` without support for deep paths.
3821
+ *
3822
+ * @private
3823
+ * @param {string} key The key of the property to get.
3824
+ * @returns {Function} Returns the new accessor function.
3825
+ */
3826
+ function baseProperty(key) {
3827
+ return function(object) {
3828
+ return object == null ? undefined : object[key];
3829
+ };
3830
+ }
3831
+
3832
+ /**
3833
+ * A specialized version of `baseProperty` which supports deep paths.
3834
+ *
3835
+ * @private
3836
+ * @param {Array|string} path The path of the property to get.
3837
+ * @returns {Function} Returns the new accessor function.
3838
+ */
3839
+ function basePropertyDeep(path) {
3840
+ return function(object) {
3841
+ return baseGet(object, path);
3842
+ };
3843
+ }
3844
+
3845
+ /**
3846
+ * Creates a function that returns the value at `path` of a given object.
3847
+ *
3848
+ * @static
3849
+ * @memberOf _
3850
+ * @since 2.4.0
3851
+ * @category Util
3852
+ * @param {Array|string} path The path of the property to get.
3853
+ * @returns {Function} Returns the new accessor function.
3854
+ * @example
3855
+ *
3856
+ * var objects = [
3857
+ * { 'a': { 'b': 2 } },
3858
+ * { 'a': { 'b': 1 } }
3859
+ * ];
3860
+ *
3861
+ * _.map(objects, _.property('a.b'));
3862
+ * // => [2, 1]
3863
+ *
3864
+ * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
3865
+ * // => [1, 2]
3866
+ */
3867
+ function property(path) {
3868
+ return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
3869
+ }
3870
+
3871
+ /**
3872
+ * The base implementation of `_.iteratee`.
3873
+ *
3874
+ * @private
3875
+ * @param {*} [value=_.identity] The value to convert to an iteratee.
3876
+ * @returns {Function} Returns the iteratee.
3877
+ */
3878
+ function baseIteratee(value) {
3879
+ // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
3880
+ // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
3881
+ if (typeof value == 'function') {
3882
+ return value;
3883
+ }
3884
+ if (value == null) {
3885
+ return identity;
3886
+ }
3887
+ if (typeof value == 'object') {
3888
+ return isArray(value)
3889
+ ? baseMatchesProperty(value[0], value[1])
3890
+ : baseMatches(value);
3891
+ }
3892
+ return property(value);
3893
+ }
3894
+
3895
+ /**
3896
+ * Creates a base function for methods like `_.forIn` and `_.forOwn`.
3897
+ *
3898
+ * @private
3899
+ * @param {boolean} [fromRight] Specify iterating from right to left.
3900
+ * @returns {Function} Returns the new base function.
3901
+ */
3902
+ function createBaseFor(fromRight) {
3903
+ return function(object, iteratee, keysFunc) {
3904
+ var index = -1,
3905
+ iterable = Object(object),
3906
+ props = keysFunc(object),
3907
+ length = props.length;
3908
+
3909
+ while (length--) {
3910
+ var key = props[fromRight ? length : ++index];
3911
+ if (iteratee(iterable[key], key, iterable) === false) {
3912
+ break;
3913
+ }
3914
+ }
3915
+ return object;
3916
+ };
3917
+ }
3918
+
3919
+ /**
3920
+ * The base implementation of `baseForOwn` which iterates over `object`
3921
+ * properties returned by `keysFunc` and invokes `iteratee` for each property.
3922
+ * Iteratee functions may exit iteration early by explicitly returning `false`.
3923
+ *
3924
+ * @private
3925
+ * @param {Object} object The object to iterate over.
3926
+ * @param {Function} iteratee The function invoked per iteration.
3927
+ * @param {Function} keysFunc The function to get the keys of `object`.
3928
+ * @returns {Object} Returns `object`.
3929
+ */
3930
+ var baseFor = createBaseFor();
3931
+
3932
+ /**
3933
+ * The base implementation of `_.forOwn` without support for iteratee shorthands.
3934
+ *
3935
+ * @private
3936
+ * @param {Object} object The object to iterate over.
3937
+ * @param {Function} iteratee The function invoked per iteration.
3938
+ * @returns {Object} Returns `object`.
3939
+ */
3940
+ function baseForOwn(object, iteratee) {
3941
+ return object && baseFor(object, iteratee, keys);
3942
+ }
3943
+
3944
+ /**
3945
+ * Creates an object with the same keys as `object` and values generated
3946
+ * by running each own enumerable string keyed property of `object` thru
3947
+ * `iteratee`. The iteratee is invoked with three arguments:
3948
+ * (value, key, object).
3949
+ *
3950
+ * @static
3951
+ * @memberOf _
3952
+ * @since 2.4.0
3953
+ * @category Object
3954
+ * @param {Object} object The object to iterate over.
3955
+ * @param {Function} [iteratee=_.identity] The function invoked per iteration.
3956
+ * @returns {Object} Returns the new mapped object.
3957
+ * @see _.mapKeys
3958
+ * @example
3959
+ *
3960
+ * var users = {
3961
+ * 'fred': { 'user': 'fred', 'age': 40 },
3962
+ * 'pebbles': { 'user': 'pebbles', 'age': 1 }
3963
+ * };
3964
+ *
3965
+ * _.mapValues(users, function(o) { return o.age; });
3966
+ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
3967
+ *
3968
+ * // The `_.property` iteratee shorthand.
3969
+ * _.mapValues(users, 'age');
3970
+ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
3971
+ */
3972
+ function mapValues(object, iteratee) {
3973
+ var result = {};
3974
+ iteratee = baseIteratee(iteratee);
3975
+
3976
+ baseForOwn(object, function(value, key, object) {
3977
+ baseAssignValue(result, key, iteratee(value, key, object));
3978
+ });
3979
+ return result;
3980
+ }
3981
+
3982
+ const react = () => {
3983
+ const config = [
3984
+ {
3985
+ files: [GLOB_JSX, GLOB_TSX],
3986
+ languageOptions: {
3987
+ parserOptions: {
3988
+ ...pluginReact.configs.recommended.parserOptions,
3989
+ ...pluginReact.configs["jsx-runtime"].parserOptions
3990
+ }
3991
+ },
3992
+ settings: {
3993
+ react: {
3994
+ // 'detect' will throw warn on monorepo
3995
+ version: "18.0"
3996
+ }
3997
+ },
3998
+ plugins: {
3999
+ react: pluginReact,
4000
+ "react-hooks": pluginReactHooks,
4001
+ "ssr-friendly": pluginSSRFriendly,
4002
+ "react-refresh": pluginReactRefresh
4003
+ },
4004
+ rules: {
4005
+ ...pluginReact.configs.recommended.rules,
4006
+ ...pluginReact.configs["jsx-runtime"].rules,
4007
+ ...pluginReactHooks.configs.recommended.rules,
4008
+ ...pluginSSRFriendly.configs.recommended.rules,
4009
+ "jsx-quotes": ["error", "prefer-double"],
4010
+ "react/prop-types": "off",
4011
+ "react/no-unescaped-entities": "off",
4012
+ "react/no-unknown-property": "off",
4013
+ "react/jsx-boolean-value": ["error", "always"],
4014
+ // Enforce new line when declare jsx element e.g. const element = (\newline<div
4015
+ "react/jsx-wrap-multilines": [
4016
+ "warn",
4017
+ {
4018
+ declaration: "parens-new-line",
4019
+ assignment: "parens-new-line",
4020
+ return: "parens-new-line",
4021
+ arrow: "parens-new-line",
4022
+ condition: "parens-new-line",
4023
+ logical: "parens-new-line",
4024
+ prop: "parens-new-line"
4025
+ }
4026
+ ],
4027
+ "react/jsx-closing-tag-location": "error",
4028
+ // Enforce disallow </ div>
4029
+ "react/jsx-tag-spacing": ["error", { closingSlash: "never", beforeSelfClosing: "always", afterOpening: "never", beforeClosing: "allow" }],
4030
+ "react/jsx-max-props-per-line": ["warn", { maximum: 1, when: "multiline" }],
4031
+ // indentLogicalExpressions will fix && element
4032
+ "react/jsx-indent": ["warn", 2, { indentLogicalExpressions: true }],
4033
+ "react/jsx-indent-props": ["warn", 2],
4034
+ // < and > should be on the same line(y-axis) if jsx is multiline
4035
+ "react/jsx-closing-bracket-location": ["warn", "tag-aligned"],
4036
+ // Enforce new line when multiline props jsx
4037
+ "react/jsx-first-prop-new-line": ["warn", "multiline-multiprop"],
4038
+ // https://github.com/ArnaudBarre/eslint-plugin-react-refresh
4039
+ "react-refresh/only-export-components": "warn"
4040
+ }
4041
+ },
4042
+ {
4043
+ files: ["**/*.test.{js,jsx,ts,tsx,cjs,mjs}", "**/*.spec.{js,jsx,ts,tsx,mjs,cjs}"],
4044
+ rules: {
4045
+ ...mapValues(pluginSSRFriendly.configs.recommended.rules, () => "off"),
4046
+ "ssr-friendly/only-export-components": "off"
4047
+ }
4048
+ }
4049
+ ];
4050
+ return config;
4051
+ };
4052
+
4053
+ const tailwindcss = () => {
4054
+ const config = [
4055
+ {
4056
+ plugins: {
4057
+ tailwindcss: pluginTailwindcss
4058
+ },
4059
+ languageOptions: {
4060
+ parserOptions: {
4061
+ ecmaFeatures: {
4062
+ jsx: true
4063
+ }
4064
+ }
4065
+ },
4066
+ rules: {
4067
+ ...pluginTailwindcss.configs.recommended.rules,
4068
+ "tailwindcss/no-custom-classname": "off"
4069
+ }
4070
+ }
4071
+ ];
4072
+ return config;
4073
+ };
4074
+
4075
+ const typescript = () => {
4076
+ const config = [
4077
+ {
4078
+ files: [GLOB_TSX, GLOB_TS, GLOB_TEST_SCRIPT],
4079
+ languageOptions: {
4080
+ parser: tsParser,
4081
+ parserOptions: {
4082
+ sourceType: "module"
4083
+ }
4084
+ },
4085
+ settings: {
4086
+ "import/resolver": {
4087
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] }
4088
+ }
4089
+ },
4090
+ plugins: {
4091
+ "@typescript-eslint": pluginTypeScript,
4092
+ etc: pluginETC
4093
+ },
4094
+ rules: {
4095
+ ...pluginTypeScript.configs.recommended.rules,
4096
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/troubleshooting/Performance.md#eslint-plugin-import
4097
+ "import/named": "off",
4098
+ "import/namespace": "off",
4099
+ "import/default": "off",
4100
+ "import/no-named-as-default-member": "off",
4101
+ "import/no-named-as-default": "off",
4102
+ // TS
4103
+ "no-useless-constructor": "off",
4104
+ indent: "off",
4105
+ // https://github.com/prettier/prettier-eslint/issues/226
4106
+ // JSX indent config in react
4107
+ "@typescript-eslint/indent": ["error", 2, {
4108
+ SwitchCase: 1,
4109
+ VariableDeclarator: 1,
4110
+ outerIIFEBody: 1,
4111
+ MemberExpression: 1,
4112
+ FunctionDeclaration: { parameters: 1, body: 1 },
4113
+ FunctionExpression: { parameters: 1, body: 1 },
4114
+ CallExpression: { arguments: 1 },
4115
+ ArrayExpression: 1,
4116
+ ObjectExpression: 1,
4117
+ ImportDeclaration: 1,
4118
+ flatTernaryExpressions: false,
4119
+ ignoreComments: false,
4120
+ ignoredNodes: [
4121
+ "TemplateLiteral *",
4122
+ "JSXElement",
4123
+ "JSXElement > *",
4124
+ "JSXAttribute",
4125
+ "JSXIdentifier",
4126
+ "JSXNamespacedName",
4127
+ "JSXMemberExpression",
4128
+ "JSXSpreadAttribute",
4129
+ "JSXExpressionContainer",
4130
+ "JSXOpeningElement",
4131
+ "JSXClosingElement",
4132
+ "JSXFragment",
4133
+ "JSXOpeningFragment",
4134
+ "JSXClosingFragment",
4135
+ "JSXText",
4136
+ "JSXEmptyExpression",
4137
+ "JSXSpreadChild",
4138
+ "TSTypeParameterInstantiation",
4139
+ "FunctionExpression > .params[decorators.length > 0]",
4140
+ "FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
4141
+ "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
4142
+ ],
4143
+ offsetTernaryExpressions: true
4144
+ }],
4145
+ "@typescript-eslint/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
4146
+ "@typescript-eslint/type-annotation-spacing": ["error", {}],
4147
+ "@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
4148
+ "@typescript-eslint/consistent-type-imports": [
4149
+ "error",
4150
+ { prefer: "type-imports", disallowTypeAnnotations: false }
4151
+ ],
4152
+ // Limit `interface` define object types, users could override with *.d.ts declare
4153
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
4154
+ "@typescript-eslint/prefer-ts-expect-error": "warn",
4155
+ "@typescript-eslint/default-param-last": "error",
4156
+ // Perfer reduce<T, S>
4157
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
4158
+ // Sort type S = A | B
4159
+ "@typescript-eslint/sort-type-constituents": "error",
4160
+ "@typescript-eslint/unbound-method": "off",
4161
+ "@typescript-eslint/prefer-for-of": "error",
4162
+ // https://www.npmjs.com/package/eslint-plugin-etc
4163
+ "etc/no-t": "error",
4164
+ /**
4165
+ * refs:
4166
+ * 1. https://ncjamieson.com/dont-export-const-enums/
4167
+ * 2. https://www.huy.rocks/everyday/02-24-2022-typescript-enums-at-runtime-and-tree-shaking
4168
+ */
4169
+ "etc/no-const-enum": "error",
4170
+ "etc/no-enum": "error",
4171
+ "etc/no-misused-generics": "error",
4172
+ // Overrides JS
4173
+ // no-spaced-func alert -- https://eslint.org/docs/latest/rules/no-spaced-func
4174
+ "func-call-spacing": "off",
4175
+ "@typescript-eslint/func-call-spacing": ["error", "never"],
4176
+ "no-unused-vars": "off",
4177
+ "no-redeclare": "off",
4178
+ "@typescript-eslint/no-redeclare": "error",
4179
+ "no-dupe-class-members": "off",
4180
+ "@typescript-eslint/no-dupe-class-members": "error",
4181
+ "no-use-before-define": "off",
4182
+ "@typescript-eslint/no-use-before-define": [
4183
+ "error",
4184
+ { functions: false, classes: false, variables: true }
4185
+ ],
4186
+ "brace-style": "off",
4187
+ // https://eslint.org/docs/latest/rules/brace-style#1tbs
4188
+ "@typescript-eslint/brace-style": ["error", "1tbs"],
4189
+ "comma-dangle": "off",
4190
+ "@typescript-eslint/comma-dangle": ["error", "always-multiline"],
4191
+ "object-curly-spacing": "off",
4192
+ "@typescript-eslint/object-curly-spacing": ["error", "always"],
4193
+ semi: "off",
4194
+ "@typescript-eslint/semi": ["error", "never"],
4195
+ quotes: "off",
4196
+ "@typescript-eslint/quotes": ["error", "single"],
4197
+ "space-before-blocks": "off",
4198
+ "@typescript-eslint/space-before-blocks": ["error", "always"],
4199
+ "space-before-function-paren": "off",
4200
+ "@typescript-eslint/space-before-function-paren": [
4201
+ "error",
4202
+ {
4203
+ anonymous: "always",
4204
+ named: "never",
4205
+ asyncArrow: "always"
4206
+ }
4207
+ ],
4208
+ "space-infix-ops": "off",
4209
+ "@typescript-eslint/space-infix-ops": "error",
4210
+ "keyword-spacing": "off",
4211
+ "@typescript-eslint/keyword-spacing": ["error", { before: true, after: true }],
4212
+ "comma-spacing": "off",
4213
+ "@typescript-eslint/comma-spacing": ["error", { before: false, after: true }],
4214
+ "no-extra-parens": "off",
4215
+ "@typescript-eslint/no-extra-parens": ["error", "functions"],
4216
+ "no-loss-of-precision": "off",
4217
+ "@typescript-eslint/no-loss-of-precision": "error",
4218
+ "lines-between-class-members": "off",
4219
+ "@typescript-eslint/lines-between-class-members": [
4220
+ "error",
4221
+ "always",
4222
+ { exceptAfterSingleLine: true }
4223
+ ],
4224
+ // off
4225
+ "@typescript-eslint/camelcase": "off",
4226
+ "@typescript-eslint/explicit-function-return-type": "off",
4227
+ "@typescript-eslint/explicit-member-accessibility": "off",
4228
+ "@typescript-eslint/no-explicit-any": "off",
4229
+ "@typescript-eslint/no-parameter-properties": "off",
4230
+ "@typescript-eslint/no-empty-interface": "off",
4231
+ "@typescript-eslint/ban-ts-ignore": "off",
4232
+ "@typescript-eslint/no-empty-function": "off",
4233
+ "@typescript-eslint/no-non-null-assertion": "off",
4234
+ "@typescript-eslint/explicit-module-boundary-types": "off",
4235
+ "@typescript-eslint/ban-types": "off",
4236
+ "@typescript-eslint/no-namespace": "off",
4237
+ "@typescript-eslint/no-var-requires": "off",
4238
+ // https://www.npmjs.com/package/eslint-plugin-unused-imports
4239
+ "@typescript-eslint/no-unused-vars": "off",
4240
+ "no-void": ["error", { allowAsStatement: true }]
4241
+ }
4242
+ },
4243
+ {
4244
+ files: [GLOB_TEST_SCRIPT, GLOB_TEST_DIRS],
4245
+ rules: {
4246
+ "no-unused-expressions": "off",
4247
+ "@typescript-eslint/no-unused-vars": "off"
4248
+ }
4249
+ }
4250
+ ];
4251
+ return config;
4252
+ };
4253
+
4254
+ const unicorn = () => {
4255
+ const config = [
4256
+ {
4257
+ plugins: {
4258
+ unicorn: pluginUnicorn
4259
+ },
4260
+ rules: {
4261
+ // unicorns
4262
+ // Pass error message when throwing errors
4263
+ "unicorn/error-message": "error",
4264
+ // Uppercase regex escapes
4265
+ "unicorn/escape-case": "error",
4266
+ // Array.isArray instead of instanceof
4267
+ "unicorn/no-array-instanceof": "error",
4268
+ // Prevent deprecated `new Buffer()`
4269
+ "unicorn/no-new-buffer": "error",
4270
+ // Keep regex literals safe!
4271
+ "unicorn/no-unsafe-regex": "off",
4272
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
4273
+ "unicorn/number-literal-case": "error",
4274
+ // ** instead of Math.pow()
4275
+ "unicorn/prefer-exponentiation-operator": "error",
4276
+ // includes over indexOf when checking for existence
4277
+ "unicorn/prefer-includes": "error",
4278
+ // String methods startsWith/endsWith instead of more complicated stuff
4279
+ "unicorn/prefer-starts-ends-with": "error",
4280
+ // textContent instead of innerText
4281
+ "unicorn/prefer-text-content": "error",
4282
+ // Enforce throwing type error when throwing error while checking typeof
4283
+ "unicorn/prefer-type-error": "error",
4284
+ // Use new when throwing error
4285
+ "unicorn/throw-new-error": "error",
4286
+ // Use `node:` for built-in node modules
4287
+ "unicorn/prefer-node-protocol": "warn"
4288
+ }
4289
+ }
4290
+ ];
4291
+ return config;
4292
+ };
4293
+
4294
+ const yml = () => {
4295
+ const config = [
4296
+ {
4297
+ files: [GLOB_YAML],
4298
+ languageOptions: {
4299
+ parser: yamlParser
4300
+ },
4301
+ plugins: {
4302
+ yml: pluginYaml
4303
+ },
4304
+ rules: {
4305
+ ...pluginYaml.configs.standard.rules,
4306
+ // yml
4307
+ "spaced-comment": "off",
4308
+ "yml/quotes": ["error", { prefer: "double", avoidEscape: false }],
4309
+ "yml/no-empty-document": "off"
4310
+ }
4311
+ },
4312
+ {
4313
+ files: [GLOB_WORKFLOW_YAML],
4314
+ rules: {
4315
+ /**
4316
+ * on:
4317
+ * push:
4318
+ * pull_request:
4319
+ * branches: []
4320
+ */
4321
+ "yml/no-empty-mapping-value": "off"
4322
+ }
4323
+ }
4324
+ ];
4325
+ return config;
4326
+ };
4327
+
4328
+ const presetJavascript = [
4329
+ ...ignores(),
4330
+ ...javascript(),
4331
+ ...comments(),
4332
+ ...imports(),
4333
+ ...unicorn()
4334
+ ];
4335
+ const presetTypescript = [
4336
+ ...presetJavascript,
4337
+ ...typescript()
4338
+ ];
4339
+ const presetLangsExtensions = [
4340
+ ...yml(),
4341
+ ...markdown(),
4342
+ ...jsonc()
4343
+ ];
4344
+ const presetDefault = [
4345
+ ...presetTypescript,
4346
+ ...react(),
4347
+ ...presetLangsExtensions,
4348
+ ...progress()
4349
+ ];
4350
+ const aiou = (config = []) => {
4351
+ const configs = [...presetDefault];
4352
+ if (isPackageExists("tailwindcss")) {
4353
+ configs.push(...tailwindcss());
4354
+ }
4355
+ if (isPackageExists("next")) {
4356
+ configs.push(...next());
4357
+ }
4358
+ if (Object.keys(config).length > 0) {
4359
+ configs.push(...Array.isArray(config) ? config : [config]);
4360
+ }
4361
+ return configs;
4362
+ };
4363
+
4364
+ export { aiou };