[Pkg-javascript-commits] [less.js] 19/88: Replacing replace's options to flags

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:22:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v1.7.0
in repository less.js.

commit 98f48bcb7890342304df8f5a2a3b1a07ddb5afcb
Author: Jake Bellacera <jakeb at eleveninc.com>
Date:   Thu Feb 6 23:41:18 2014 -0800

    Replacing replace's options to flags
---
 lib/less/functions.js    | 4 ++--
 test/css/functions.css   | 2 +-
 test/less/functions.less | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/less/functions.js b/lib/less/functions.js
index 96f9c3b..7b11959 100644
--- a/lib/less/functions.js
+++ b/lib/less/functions.js
@@ -218,10 +218,10 @@ tree.functions = {
     escape: function (str) {
         return new(tree.Anonymous)(encodeURI(str.value).replace(/=/g, "%3D").replace(/:/g, "%3A").replace(/#/g, "%23").replace(/;/g, "%3B").replace(/\(/g, "%28").replace(/\)/g, "%29"));
     },
-    replace: function (subject, pattern, replacement, options) {
+    replace: function (subject, pattern, replacement, flags) {
         var str = subject.value;
 
-        str = str.replace(new RegExp(pattern.value, options ? options.value : ""), replacement.value);
+        str = str.replace(new RegExp(pattern.value, flags ? flags.value : ""), replacement.value);
 
         return new(tree.Quoted)('"' + str + '"', str);
     },
diff --git a/test/css/functions.css b/test/css/functions.css
index 0ba7a27..e7ea76c 100644
--- a/test/css/functions.css
+++ b/test/css/functions.css
@@ -47,7 +47,7 @@
   contrast-low-thresh-per: #111111;
   replace: "Hello, World!";
   replace-captured: "This is a new string.";
-  replace-options: "2 + 2 = 4";
+  replace-with-flags: "2 + 2 = 4";
   format: "rgb(32, 128, 64)";
   format-string: "hello world";
   format-multiple: "hello earth 2";
diff --git a/test/less/functions.less b/test/less/functions.less
index cac404f..7420cc8 100644
--- a/test/less/functions.less
+++ b/test/less/functions.less
@@ -51,7 +51,7 @@
   contrast-low-thresh-per: contrast(#555, #111111, #eeeeee, 10%);
   replace: replace("Hello, Mars.", "Mars\.", "World!");
   replace-captured: replace("This is a string.", "(string)\.$", "new $1.");
-  replace-options: replace("One + one = 4", "one", "2", "gi");
+  replace-with-flags: replace("One + one = 4", "one", "2", "gi");
   format: %("rgb(%d, %d, %d)", @r, 128, 64);
   format-string: %("hello %s", "world");
   format-multiple: %("hello %s %d", "earth", 2);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list