summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/strings/addslashes.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/strings/addslashes.js')
-rw-r--r--node_modules/locutus/php/strings/addslashes.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/node_modules/locutus/php/strings/addslashes.js b/node_modules/locutus/php/strings/addslashes.js
new file mode 100644
index 0000000..b7c52ea
--- /dev/null
+++ b/node_modules/locutus/php/strings/addslashes.js
@@ -0,0 +1,18 @@
+'use strict';
+
+module.exports = function addslashes(str) {
+ // discuss at: http://locutus.io/php/addslashes/
+ // original by: Kevin van Zonneveld (http://kvz.io)
+ // improved by: Ates Goral (http://magnetiq.com)
+ // improved by: marrtins
+ // improved by: Nate
+ // improved by: Onno Marsman (https://twitter.com/onnomarsman)
+ // improved by: Brett Zamir (http://brett-zamir.me)
+ // improved by: Oskar Larsson Högfeldt (http://oskar-lh.name/)
+ // input by: Denny Wardhana
+ // example 1: addslashes("kevin's birthday")
+ // returns 1: "kevin\\'s birthday"
+
+ return (str + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');
+};
+//# sourceMappingURL=addslashes.js.map \ No newline at end of file