From 16caaddc52a5440bb5a661600eb32969c6a2e597 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Tue, 25 Apr 2017 19:14:18 +0200 Subject: [PATCH] Allow RegExp to String coercion Closes #3 --- spec.emu | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec.emu b/spec.emu index 2411213..a9c8e09 100644 --- a/spec.emu +++ b/spec.emu @@ -12,7 +12,9 @@ contributors: Jordan Harband 1. Let _matcher_ be ? GetMethod(_regexp_, @@matchAll). 1. If _matcher_ is not *undefined*, then 1. Return ? Call(_matcher_, _regexp_, « _O_ »). - 1. Throw a *TypeError* exception. + 1. Let _S_ be ? ToString(_O_). + 1. Let _rx_ be ? RegExpCreate(_regexp_, *undefined*). + 1. Return ? Invoke(_rx_, @@matchAll, « _S_ »). Similarly to String.prototype.split, String.prototype.matchAll is designed to typically act without mutating its inputs.