Upgrade to https://github.com/acornjs/acorn.git commit 84eda6bf
[jst.git] / src / util.js
index 9f548a1..8262cc6 100644 (file)
@@ -1,11 +1,15 @@
 const {hasOwnProperty, toString} = Object.prototype
 
-// Checks if an object has a property.
-
-export function has(obj, propName) {
-  return hasOwnProperty.call(obj, propName)
-}
+export const hasOwn = Object.hasOwn || ((obj, propName) => (
+  hasOwnProperty.call(obj, propName)
+))
 
 export const isArray = Array.isArray || ((obj) => (
   toString.call(obj) === "[object Array]"
 ))
+
+export function wordsRegexp(words) {
+  return new RegExp("^(?:" + words.replace(/ /g, "|") + ")$")
+}
+
+export const loneSurrogate = /[\uD800-\uDFFF]/u