js_regex 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/js_regex/converter/literal_converter.rb +7 -7
- data/lib/js_regex/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51325dd96254627899013c620a338c8833daee8f4f22601e0975490b6366045e
|
4
|
+
data.tar.gz: 4460d650303b8cffa4e77084450458f29e7fd211a3ee474033866323cac8ca11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56e82a1166133ec0c68a6be300801ff59fe2b0762701e31c48723704195cf469f22c4c59adc53314c7b3c83c747cb49858fc367138bb9f2079b87f43f7bb44fe
|
7
|
+
data.tar.gz: b8a14c0bf535a1f4f3a4102a42b7aa0ee6a9d25da58aa9924f15b0b77d31ea6cca167588898debf2fe7bd9c8052e0f2c8d037da1a1736b93ace6d603580552c9
|
@@ -15,9 +15,9 @@ class JsRegex
|
|
15
15
|
if data =~ ASTRAL_PLANE_CODEPOINT_PATTERN
|
16
16
|
surrogate_pair_for(data)
|
17
17
|
else
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
ensure_json_compatibility(
|
19
|
+
ensure_forward_slashes_are_escaped(data)
|
20
|
+
)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,16 +27,16 @@ class JsRegex
|
|
27
27
|
base = astral_char.codepoints.first - 65_536
|
28
28
|
high = ((base / 1024).floor + 55_296).to_s(16)
|
29
29
|
low = (base % 1024 + 56_320).to_s(16)
|
30
|
-
"
|
30
|
+
"(?:\\u#{high}\\u#{low})"
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def ensure_forward_slashes_are_escaped(data)
|
34
34
|
# literal slashes would signify the pattern end in JsRegex#to_s
|
35
|
-
data.gsub
|
35
|
+
data.gsub(%r{\\?/}, '\\/')
|
36
36
|
end
|
37
37
|
|
38
38
|
def ensure_json_compatibility(data)
|
39
|
-
data.gsub
|
39
|
+
data.gsub(%r{\\?([\f\n\r\t])}) { Regexp.escape($1) }
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
data/lib/js_regex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_regex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janosch Müller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: regexp_parser
|
@@ -100,6 +100,20 @@ dependencies:
|
|
100
100
|
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0.12'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: mutant-rspec
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.8'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.8'
|
103
117
|
description: JsRegex converts Ruby's native regular expressions for JavaScript, taking
|
104
118
|
care of various incompatibilities and returning warnings for unsolvable differences.
|
105
119
|
email:
|