trusty-cms 4.1.4 → 4.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +68 -68
- data/README.md +1 -1
- data/app/assets/javascripts/admin/assets.js +1 -1
- data/lib/trusty_cms.rb +1 -1
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/core.js +126 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/index.js +4 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/map.js +56 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/seq.js +43 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/failsafe/string.js +28 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/index.js +36 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/json.js +76 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/options.js +23 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/binary.js +87 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/index.js +157 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/omap.js +142 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/pairs.js +81 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/set.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/browser/dist/tags/yaml-1.1/timestamp.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/core.js +114 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/index.js +17 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/map.js +37 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/seq.js +34 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/failsafe/string.js +40 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/index.js +62 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/json.js +60 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/options.js +35 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/binary.js +97 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/index.js +131 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/omap.js +105 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/pairs.js +80 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/set.js +91 -0
- data/spec/spec/dummy/node_modules/yaml/dist/tags/yaml-1.1/timestamp.js +93 -0
- data/trusty_cms.gemspec +1 -1
- data/yarn.lock +3 -3
- metadata +7563 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aec3fc02d82b69c746822773abba3b5dca525b4517ce22f5f2b90370f98a500d
|
4
|
+
data.tar.gz: 6e873c828c7208ddb4e83118a26a854c701e7a52f95636fe56304b23a70a9bbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f514772d660155663d30d4008306b394eba8c4da9dc77a025de5fc01e72905c0135322aa98b93d580e5f45b1f8a1259a44bc7248513d40c310007eb703dcdd28
|
7
|
+
data.tar.gz: bbe958ef9e0cb0404bf9126fa46b37a58a02bd708ba2cd5a3e7c6a05f86dcf9ca689fb2fc314053078ceee21d0c9bac2f4f1ee8668789b737f4bc6f51e80ae2c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trusty-cms (4.1.
|
4
|
+
trusty-cms (4.1.5)
|
5
5
|
RedCloth (= 4.3.2)
|
6
6
|
acts_as_list (>= 0.9.5, < 1.1.0)
|
7
7
|
acts_as_tree (>= 2.6.1, < 2.9.0)
|
@@ -27,63 +27,63 @@ PATH
|
|
27
27
|
stringex (>= 2.7.1, < 2.9.0)
|
28
28
|
tzinfo (>= 1.2.3, < 2.1.0)
|
29
29
|
uglifier (>= 3.2, < 5.0)
|
30
|
-
uuidtools (
|
30
|
+
uuidtools (>= 2.1.5, < 2.3.0)
|
31
31
|
will_paginate (~> 3.0)
|
32
32
|
|
33
33
|
GEM
|
34
34
|
remote: https://rubygems.org/
|
35
35
|
specs:
|
36
36
|
RedCloth (4.3.2)
|
37
|
-
actioncable (6.0.3.
|
38
|
-
actionpack (= 6.0.3.
|
37
|
+
actioncable (6.0.3.2)
|
38
|
+
actionpack (= 6.0.3.2)
|
39
39
|
nio4r (~> 2.0)
|
40
40
|
websocket-driver (>= 0.6.1)
|
41
|
-
actionmailbox (6.0.3.
|
42
|
-
actionpack (= 6.0.3.
|
43
|
-
activejob (= 6.0.3.
|
44
|
-
activerecord (= 6.0.3.
|
45
|
-
activestorage (= 6.0.3.
|
46
|
-
activesupport (= 6.0.3.
|
41
|
+
actionmailbox (6.0.3.2)
|
42
|
+
actionpack (= 6.0.3.2)
|
43
|
+
activejob (= 6.0.3.2)
|
44
|
+
activerecord (= 6.0.3.2)
|
45
|
+
activestorage (= 6.0.3.2)
|
46
|
+
activesupport (= 6.0.3.2)
|
47
47
|
mail (>= 2.7.1)
|
48
|
-
actionmailer (6.0.3.
|
49
|
-
actionpack (= 6.0.3.
|
50
|
-
actionview (= 6.0.3.
|
51
|
-
activejob (= 6.0.3.
|
48
|
+
actionmailer (6.0.3.2)
|
49
|
+
actionpack (= 6.0.3.2)
|
50
|
+
actionview (= 6.0.3.2)
|
51
|
+
activejob (= 6.0.3.2)
|
52
52
|
mail (~> 2.5, >= 2.5.4)
|
53
53
|
rails-dom-testing (~> 2.0)
|
54
|
-
actionpack (6.0.3.
|
55
|
-
actionview (= 6.0.3.
|
56
|
-
activesupport (= 6.0.3.
|
54
|
+
actionpack (6.0.3.2)
|
55
|
+
actionview (= 6.0.3.2)
|
56
|
+
activesupport (= 6.0.3.2)
|
57
57
|
rack (~> 2.0, >= 2.0.8)
|
58
58
|
rack-test (>= 0.6.3)
|
59
59
|
rails-dom-testing (~> 2.0)
|
60
60
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
61
|
-
actiontext (6.0.3.
|
62
|
-
actionpack (= 6.0.3.
|
63
|
-
activerecord (= 6.0.3.
|
64
|
-
activestorage (= 6.0.3.
|
65
|
-
activesupport (= 6.0.3.
|
61
|
+
actiontext (6.0.3.2)
|
62
|
+
actionpack (= 6.0.3.2)
|
63
|
+
activerecord (= 6.0.3.2)
|
64
|
+
activestorage (= 6.0.3.2)
|
65
|
+
activesupport (= 6.0.3.2)
|
66
66
|
nokogiri (>= 1.8.5)
|
67
|
-
actionview (6.0.3.
|
68
|
-
activesupport (= 6.0.3.
|
67
|
+
actionview (6.0.3.2)
|
68
|
+
activesupport (= 6.0.3.2)
|
69
69
|
builder (~> 3.1)
|
70
70
|
erubi (~> 1.4)
|
71
71
|
rails-dom-testing (~> 2.0)
|
72
72
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
73
|
-
activejob (6.0.3.
|
74
|
-
activesupport (= 6.0.3.
|
73
|
+
activejob (6.0.3.2)
|
74
|
+
activesupport (= 6.0.3.2)
|
75
75
|
globalid (>= 0.3.6)
|
76
|
-
activemodel (6.0.3.
|
77
|
-
activesupport (= 6.0.3.
|
78
|
-
activerecord (6.0.3.
|
79
|
-
activemodel (= 6.0.3.
|
80
|
-
activesupport (= 6.0.3.
|
81
|
-
activestorage (6.0.3.
|
82
|
-
actionpack (= 6.0.3.
|
83
|
-
activejob (= 6.0.3.
|
84
|
-
activerecord (= 6.0.3.
|
76
|
+
activemodel (6.0.3.2)
|
77
|
+
activesupport (= 6.0.3.2)
|
78
|
+
activerecord (6.0.3.2)
|
79
|
+
activemodel (= 6.0.3.2)
|
80
|
+
activesupport (= 6.0.3.2)
|
81
|
+
activestorage (6.0.3.2)
|
82
|
+
actionpack (= 6.0.3.2)
|
83
|
+
activejob (= 6.0.3.2)
|
84
|
+
activerecord (= 6.0.3.2)
|
85
85
|
marcel (~> 0.3.1)
|
86
|
-
activesupport (6.0.3.
|
86
|
+
activesupport (6.0.3.2)
|
87
87
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
88
88
|
i18n (>= 0.7, < 2)
|
89
89
|
minitest (~> 5.1)
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
activerecord (>= 3.0.0)
|
96
96
|
addressable (2.7.0)
|
97
97
|
public_suffix (>= 2.0.2, < 5.0)
|
98
|
-
bcrypt (3.1.
|
98
|
+
bcrypt (3.1.15)
|
99
99
|
builder (3.2.4)
|
100
100
|
byebug (11.1.3)
|
101
101
|
capybara (3.32.2)
|
@@ -132,11 +132,11 @@ GEM
|
|
132
132
|
erubi (1.9.0)
|
133
133
|
erubis (2.7.0)
|
134
134
|
execjs (2.7.0)
|
135
|
-
factory_bot (
|
136
|
-
activesupport (>=
|
137
|
-
factory_bot_rails (
|
138
|
-
factory_bot (~>
|
139
|
-
railties (>=
|
135
|
+
factory_bot (6.1.0)
|
136
|
+
activesupport (>= 5.0.0)
|
137
|
+
factory_bot_rails (6.1.0)
|
138
|
+
factory_bot (~> 6.1.0)
|
139
|
+
railties (>= 5.0.0)
|
140
140
|
ffi (1.13.1)
|
141
141
|
globalid (0.4.2)
|
142
142
|
activesupport (>= 4.2.0)
|
@@ -158,9 +158,9 @@ GEM
|
|
158
158
|
httparty (0.18.1)
|
159
159
|
mime-types (~> 3.0)
|
160
160
|
multi_xml (>= 0.5.2)
|
161
|
-
i18n (1.8.
|
161
|
+
i18n (1.8.5)
|
162
162
|
concurrent-ruby (~> 1.0)
|
163
|
-
json (2.3.
|
163
|
+
json (2.3.1)
|
164
164
|
kraken-io (0.1.3)
|
165
165
|
activesupport
|
166
166
|
httparty
|
@@ -168,8 +168,8 @@ GEM
|
|
168
168
|
multipart-post
|
169
169
|
launchy (2.5.0)
|
170
170
|
addressable (~> 2.7)
|
171
|
-
libv8 (
|
172
|
-
loofah (2.
|
171
|
+
libv8 (8.4.255.0)
|
172
|
+
loofah (2.6.0)
|
173
173
|
crass (~> 1.0.2)
|
174
174
|
nokogiri (>= 1.5.9)
|
175
175
|
mail (2.7.1)
|
@@ -183,14 +183,14 @@ GEM
|
|
183
183
|
mimemagic (0.3.5)
|
184
184
|
mini_mime (1.0.2)
|
185
185
|
mini_portile2 (2.4.0)
|
186
|
-
mini_racer (0.
|
187
|
-
libv8 (
|
186
|
+
mini_racer (0.3.1)
|
187
|
+
libv8 (~> 8.4.255)
|
188
188
|
minitest (5.14.1)
|
189
189
|
multi_xml (0.6.0)
|
190
190
|
multipart-post (2.1.1)
|
191
191
|
mysql2 (0.5.3)
|
192
192
|
nio4r (2.5.2)
|
193
|
-
nokogiri (1.10.
|
193
|
+
nokogiri (1.10.10)
|
194
194
|
mini_portile2 (~> 2.4.0)
|
195
195
|
orm_adapter (0.5.0)
|
196
196
|
paperclip (6.1.0)
|
@@ -216,20 +216,20 @@ GEM
|
|
216
216
|
rack-test (1.1.0)
|
217
217
|
rack (>= 1.0, < 3)
|
218
218
|
radius (0.7.5)
|
219
|
-
rails (6.0.3.
|
220
|
-
actioncable (= 6.0.3.
|
221
|
-
actionmailbox (= 6.0.3.
|
222
|
-
actionmailer (= 6.0.3.
|
223
|
-
actionpack (= 6.0.3.
|
224
|
-
actiontext (= 6.0.3.
|
225
|
-
actionview (= 6.0.3.
|
226
|
-
activejob (= 6.0.3.
|
227
|
-
activemodel (= 6.0.3.
|
228
|
-
activerecord (= 6.0.3.
|
229
|
-
activestorage (= 6.0.3.
|
230
|
-
activesupport (= 6.0.3.
|
219
|
+
rails (6.0.3.2)
|
220
|
+
actioncable (= 6.0.3.2)
|
221
|
+
actionmailbox (= 6.0.3.2)
|
222
|
+
actionmailer (= 6.0.3.2)
|
223
|
+
actionpack (= 6.0.3.2)
|
224
|
+
actiontext (= 6.0.3.2)
|
225
|
+
actionview (= 6.0.3.2)
|
226
|
+
activejob (= 6.0.3.2)
|
227
|
+
activemodel (= 6.0.3.2)
|
228
|
+
activerecord (= 6.0.3.2)
|
229
|
+
activestorage (= 6.0.3.2)
|
230
|
+
activesupport (= 6.0.3.2)
|
231
231
|
bundler (>= 1.3.0)
|
232
|
-
railties (= 6.0.3.
|
232
|
+
railties (= 6.0.3.2)
|
233
233
|
sprockets-rails (>= 2.0.0)
|
234
234
|
rails-dom-testing (2.0.3)
|
235
235
|
activesupport (>= 4.2.0)
|
@@ -238,9 +238,9 @@ GEM
|
|
238
238
|
loofah (~> 2.3)
|
239
239
|
rails-observers (0.1.5)
|
240
240
|
activemodel (>= 4.0)
|
241
|
-
railties (6.0.3.
|
242
|
-
actionpack (= 6.0.3.
|
243
|
-
activesupport (= 6.0.3.
|
241
|
+
railties (6.0.3.2)
|
242
|
+
actionpack (= 6.0.3.2)
|
243
|
+
activesupport (= 6.0.3.2)
|
244
244
|
method_source
|
245
245
|
rake (>= 0.8.7)
|
246
246
|
thor (>= 0.20.3, < 2.0)
|
@@ -308,7 +308,7 @@ GEM
|
|
308
308
|
thread_safe (~> 0.1)
|
309
309
|
uglifier (4.2.0)
|
310
310
|
execjs (>= 0.3.0, < 3)
|
311
|
-
uuidtools (2.
|
311
|
+
uuidtools (2.2.0)
|
312
312
|
warden (1.2.8)
|
313
313
|
rack (>= 2.0.6)
|
314
314
|
websocket-driver (0.7.2)
|
@@ -317,7 +317,7 @@ GEM
|
|
317
317
|
will_paginate (3.3.0)
|
318
318
|
xpath (3.2.0)
|
319
319
|
nokogiri (~> 1.8)
|
320
|
-
zeitwerk (2.
|
320
|
+
zeitwerk (2.4.0)
|
321
321
|
|
322
322
|
PLATFORMS
|
323
323
|
ruby
|
@@ -325,7 +325,7 @@ PLATFORMS
|
|
325
325
|
DEPENDENCIES
|
326
326
|
acts_as_list
|
327
327
|
database_cleaner
|
328
|
-
factory_bot_rails (=
|
328
|
+
factory_bot_rails (= 6.1.0)
|
329
329
|
launchy (~> 2.5.0)
|
330
330
|
mysql2
|
331
331
|
poltergeist (~> 1.18.1)
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/trusty-cms.svg)](http://badge.fury.io/rb/trusty-cms)
|
4
4
|
|
5
|
-
TrustyCMS is a branch of Radiant CMS. Its goal is to pull the Radiant framework into Rails
|
5
|
+
TrustyCMS is a branch of Radiant CMS. Its goal is to pull the Radiant framework into Rails 6 with minimal changes to its infrastructure.
|
6
6
|
|
7
7
|
TrustyCMS is a no-fluff, open source content management system designed for
|
8
8
|
small teams. It is similar to Textpattern or MovableType, but is a general
|
data/lib/trusty_cms.rb
CHANGED
@@ -0,0 +1,126 @@
|
|
1
|
+
import Scalar from '../schema/Scalar';
|
2
|
+
import { stringifyNumber } from '../stringify';
|
3
|
+
import failsafe from './failsafe';
|
4
|
+
import { boolOptions, nullOptions } from './options';
|
5
|
+
export var nullObj = {
|
6
|
+
identify: function identify(value) {
|
7
|
+
return value == null;
|
8
|
+
},
|
9
|
+
createNode: function createNode(schema, value, ctx) {
|
10
|
+
return ctx.wrapScalars ? new Scalar(null) : null;
|
11
|
+
},
|
12
|
+
default: true,
|
13
|
+
tag: 'tag:yaml.org,2002:null',
|
14
|
+
test: /^(?:~|[Nn]ull|NULL)?$/,
|
15
|
+
resolve: function resolve() {
|
16
|
+
return null;
|
17
|
+
},
|
18
|
+
options: nullOptions,
|
19
|
+
stringify: function stringify() {
|
20
|
+
return nullOptions.nullStr;
|
21
|
+
}
|
22
|
+
};
|
23
|
+
export var boolObj = {
|
24
|
+
identify: function identify(value) {
|
25
|
+
return typeof value === 'boolean';
|
26
|
+
},
|
27
|
+
default: true,
|
28
|
+
tag: 'tag:yaml.org,2002:bool',
|
29
|
+
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
30
|
+
resolve: function resolve(str) {
|
31
|
+
return str[0] === 't' || str[0] === 'T';
|
32
|
+
},
|
33
|
+
options: boolOptions,
|
34
|
+
stringify: function stringify(_ref) {
|
35
|
+
var value = _ref.value;
|
36
|
+
return value ? boolOptions.trueStr : boolOptions.falseStr;
|
37
|
+
}
|
38
|
+
};
|
39
|
+
export var octObj = {
|
40
|
+
identify: function identify(value) {
|
41
|
+
return typeof value === 'number';
|
42
|
+
},
|
43
|
+
default: true,
|
44
|
+
tag: 'tag:yaml.org,2002:int',
|
45
|
+
format: 'OCT',
|
46
|
+
test: /^0o([0-7]+)$/,
|
47
|
+
resolve: function resolve(str, oct) {
|
48
|
+
return parseInt(oct, 8);
|
49
|
+
},
|
50
|
+
stringify: function stringify(_ref2) {
|
51
|
+
var value = _ref2.value;
|
52
|
+
return '0o' + value.toString(8);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
export var intObj = {
|
56
|
+
identify: function identify(value) {
|
57
|
+
return typeof value === 'number';
|
58
|
+
},
|
59
|
+
default: true,
|
60
|
+
tag: 'tag:yaml.org,2002:int',
|
61
|
+
test: /^[-+]?[0-9]+$/,
|
62
|
+
resolve: function resolve(str) {
|
63
|
+
return parseInt(str, 10);
|
64
|
+
},
|
65
|
+
stringify: stringifyNumber
|
66
|
+
};
|
67
|
+
export var hexObj = {
|
68
|
+
identify: function identify(value) {
|
69
|
+
return typeof value === 'number';
|
70
|
+
},
|
71
|
+
default: true,
|
72
|
+
tag: 'tag:yaml.org,2002:int',
|
73
|
+
format: 'HEX',
|
74
|
+
test: /^0x([0-9a-fA-F]+)$/,
|
75
|
+
resolve: function resolve(str, hex) {
|
76
|
+
return parseInt(hex, 16);
|
77
|
+
},
|
78
|
+
stringify: function stringify(_ref3) {
|
79
|
+
var value = _ref3.value;
|
80
|
+
return '0x' + value.toString(16);
|
81
|
+
}
|
82
|
+
};
|
83
|
+
export var nanObj = {
|
84
|
+
identify: function identify(value) {
|
85
|
+
return typeof value === 'number';
|
86
|
+
},
|
87
|
+
default: true,
|
88
|
+
tag: 'tag:yaml.org,2002:float',
|
89
|
+
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
90
|
+
resolve: function resolve(str, nan) {
|
91
|
+
return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
|
92
|
+
},
|
93
|
+
stringify: stringifyNumber
|
94
|
+
};
|
95
|
+
export var expObj = {
|
96
|
+
identify: function identify(value) {
|
97
|
+
return typeof value === 'number';
|
98
|
+
},
|
99
|
+
default: true,
|
100
|
+
tag: 'tag:yaml.org,2002:float',
|
101
|
+
format: 'EXP',
|
102
|
+
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
103
|
+
resolve: function resolve(str) {
|
104
|
+
return parseFloat(str);
|
105
|
+
},
|
106
|
+
stringify: function stringify(_ref4) {
|
107
|
+
var value = _ref4.value;
|
108
|
+
return Number(value).toExponential();
|
109
|
+
}
|
110
|
+
};
|
111
|
+
export var floatObj = {
|
112
|
+
identify: function identify(value) {
|
113
|
+
return typeof value === 'number';
|
114
|
+
},
|
115
|
+
default: true,
|
116
|
+
tag: 'tag:yaml.org,2002:float',
|
117
|
+
test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
|
118
|
+
resolve: function resolve(str, frac1, frac2) {
|
119
|
+
var frac = frac1 || frac2;
|
120
|
+
var node = new Scalar(parseFloat(str));
|
121
|
+
if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
|
122
|
+
return node;
|
123
|
+
},
|
124
|
+
stringify: stringifyNumber
|
125
|
+
};
|
126
|
+
export default failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
import YAMLMap from '../../schema/Map';
|
4
|
+
import parseMap from '../../schema/parseMap';
|
5
|
+
|
6
|
+
function createMap(schema, obj, ctx) {
|
7
|
+
var map = new YAMLMap(schema);
|
8
|
+
|
9
|
+
if (obj instanceof Map) {
|
10
|
+
var _iteratorNormalCompletion = true;
|
11
|
+
var _didIteratorError = false;
|
12
|
+
var _iteratorError = undefined;
|
13
|
+
|
14
|
+
try {
|
15
|
+
for (var _iterator = obj[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
16
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
17
|
+
key = _step$value[0],
|
18
|
+
value = _step$value[1];
|
19
|
+
|
20
|
+
map.items.push(schema.createPair(key, value, ctx));
|
21
|
+
}
|
22
|
+
} catch (err) {
|
23
|
+
_didIteratorError = true;
|
24
|
+
_iteratorError = err;
|
25
|
+
} finally {
|
26
|
+
try {
|
27
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
28
|
+
_iterator.return();
|
29
|
+
}
|
30
|
+
} finally {
|
31
|
+
if (_didIteratorError) {
|
32
|
+
throw _iteratorError;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
} else if (obj && _typeof(obj) === 'object') {
|
37
|
+
for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
|
38
|
+
var _key = _Object$keys[_i];
|
39
|
+
map.items.push(schema.createPair(_key, obj[_key], ctx));
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
if (typeof schema.sortMapEntries === 'function') {
|
44
|
+
map.items.sort(schema.sortMapEntries);
|
45
|
+
}
|
46
|
+
|
47
|
+
return map;
|
48
|
+
}
|
49
|
+
|
50
|
+
export default {
|
51
|
+
createNode: createMap,
|
52
|
+
default: true,
|
53
|
+
nodeClass: YAMLMap,
|
54
|
+
tag: 'tag:yaml.org,2002:map',
|
55
|
+
resolve: parseMap
|
56
|
+
};
|