diff --git a/lib/internal/locks.js b/lib/internal/locks.js index b3d605aa8bc79e..d2a0ce66385e85 100644 --- a/lib/internal/locks.js +++ b/lib/internal/locks.js @@ -6,6 +6,7 @@ const { PromisePrototypeThen, PromiseResolve, SafePromisePrototypeFinally, + StringPrototypeStartsWith, Symbol, SymbolToStringTag, } = primordials; @@ -159,7 +160,7 @@ class LockManager { signal.throwIfAborted(); } - if (name.startsWith('-')) { + if (StringPrototypeStartsWith(name, '-')) { // If name starts with U+002D HYPHEN-MINUS (-), then reject promise with a // "NotSupportedError" DOMException. throw lazyDOMException('Lock name may not start with hyphen',