.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / pretty-format / build / plugins / asymmetric_matcher.js
1 'use strict';
2
3 Object.defineProperty(exports, '__esModule', {
4   value: true
5 });
6 exports.test = exports.serialize = undefined;
7
8 var _collections = require('../collections');
9
10 /**
11  * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
12  *
13  * This source code is licensed under the MIT license found in the
14  * LICENSE file in the root directory of this source tree.
15  *
16  *
17  */
18
19 const asymmetricMatcher = Symbol.for('jest.asymmetricMatcher');
20 const SPACE = ' ';
21
22 const serialize = (exports.serialize = (
23   val,
24   config,
25   indentation,
26   depth,
27   refs,
28   printer
29 ) => {
30   const stringedValue = val.toString();
31
32   if (
33     stringedValue === 'ArrayContaining' ||
34     stringedValue === 'ArrayNotContaining'
35   ) {
36     if (++depth > config.maxDepth) {
37       return '[' + stringedValue + ']';
38     }
39     return (
40       stringedValue +
41       SPACE +
42       '[' +
43       (0, _collections.printListItems)(
44         val.sample,
45         config,
46         indentation,
47         depth,
48         refs,
49         printer
50       ) +
51       ']'
52     );
53   }
54
55   if (
56     stringedValue === 'ObjectContaining' ||
57     stringedValue === 'ObjectNotContaining'
58   ) {
59     if (++depth > config.maxDepth) {
60       return '[' + stringedValue + ']';
61     }
62     return (
63       stringedValue +
64       SPACE +
65       '{' +
66       (0, _collections.printObjectProperties)(
67         val.sample,
68         config,
69         indentation,
70         depth,
71         refs,
72         printer
73       ) +
74       '}'
75     );
76   }
77
78   if (
79     stringedValue === 'StringMatching' ||
80     stringedValue === 'StringNotMatching'
81   ) {
82     return (
83       stringedValue +
84       SPACE +
85       printer(val.sample, config, indentation, depth, refs)
86     );
87   }
88
89   if (
90     stringedValue === 'StringContaining' ||
91     stringedValue === 'StringNotContaining'
92   ) {
93     return (
94       stringedValue +
95       SPACE +
96       printer(val.sample, config, indentation, depth, refs)
97     );
98   }
99
100   return val.toAsymmetricMatcher();
101 });
102
103 const test = (exports.test = val => val && val.$$typeof === asymmetricMatcher);
104
105 exports.default = {serialize: serialize, test: test};