js_regex 3.10.0 → 3.11.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d173eb73a162ff8217d802e307396f07560d040afdccced0a4eb6ecfffc8b03c
4
- data.tar.gz: 7067783f86ada3bdf592db5b9507127c7531437ade9db9c35b09578758db30b8
3
+ metadata.gz: 6c55b0dded778c8851267d5d6d24c4a1afcbdb64e6d28ef3e48da5ba8acaf4d8
4
+ data.tar.gz: 71cf3ead5808405c0e32a2fa2dd63a8efa6f5f02df9ef707c12d4238087121a6
5
5
  SHA512:
6
- metadata.gz: 3de515b4bfa03c8cefbbe5924adb628fb1029f65b66c50931f70105a8617c96c52402fc6ffb43fe7fc949741a4067d6180c7108f8fa36cbdd23754168e9829a6
7
- data.tar.gz: 544e70d9a700e145e74e91758194f41a79d56bbf4655e8d80ef8340a3c6bf3f8695b05057ca02e930461751bacea4a5aeaa6fbb4fb5908129f059fa3d908f077
6
+ metadata.gz: d5cb89a802b4c90382146f6a49e2c0fbefa5aed7580d0698e8bd392e05ed172880a713dc619b484e9fa0f28689b1b03c35eb08f9efc6673895ca1a450985723e
7
+ data.tar.gz: c0c8fda9db5419e5d05b43036190d1fb3d9e44d32c7f57598f21cb6c16d444208dae18ed6cdeb871357188619113475f83deb70c4eef2babfc44a37c27cbbbb9
@@ -55,6 +55,8 @@ class JsRegex
55
55
  TypeConverter.directly_compatible?(exp, context) &&
56
56
  exp.text
57
57
  when :escape
58
+ return exp.text if SET_SPECIFIC_ESCAPES_PATTERN.match?(exp.text)
59
+
58
60
  case exp.token
59
61
  when *CONVERTIBLE_ESCAPE_TOKENS
60
62
  EscapeConverter.new.convert(exp, context)
@@ -65,6 +67,7 @@ class JsRegex
65
67
  end
66
68
  end
67
69
 
70
+ SET_SPECIFIC_ESCAPES_PATTERN = /[\^\-]/
68
71
  CONVERTIBLE_ESCAPE_TOKENS = %i[control meta_sequence bell escape octal] +
69
72
  EscapeConverter::ESCAPES_SHARED_BY_RUBY_AND_JS
70
73
 
@@ -8,7 +8,7 @@ class JsRegex
8
8
  def self.cast(arg)
9
9
  return ES2009 if arg.nil?
10
10
 
11
- normalized_arg = arg.to_s.upcase
11
+ normalized_arg = arg.to_s.upcase.sub(/^(ECMASCRIPT|ES|JAVASCRIPT|JS)? ?/, 'ES')
12
12
  return normalized_arg if SUPPORTED.include?(normalized_arg)
13
13
 
14
14
  raise ArgumentError.new(
@@ -1,3 +1,3 @@
1
1
  class JsRegex
2
- VERSION = '3.10.0'
2
+ VERSION = '3.11.0'
3
3
  end
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: 3.10.0
4
+ version: 3.11.0
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: 2023-01-29 00:00:00.000000000 Z
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: character_set