Skip to content

Commit 8d04297

Browse files
committed
Prototype plugins moved into to from test
1 parent b3a807d commit 8d04297

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

src/js/api.plugin.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,28 @@ $(document).ready(function () {
2626
}, 500);
2727
});
2828
});
29+
30+
/*******************************************************************************
31+
Application - Plugin - sprintf
32+
*******************************************************************************/
33+
String.prototype.sprintf = String.prototype.sprintf || function (params) {
34+
params = params || [];
35+
36+
var sprintfRegex = /\{(\d+)\}/g;
37+
var sprintf = function (match, number) {
38+
return number in params ? params[number] : match;
39+
};
40+
41+
if (Array.isArray(params) && params.length)
42+
return this.replace(sprintfRegex, sprintf);
43+
else
44+
return this;
45+
};
46+
47+
/*******************************************************************************
48+
Application - Plugin - ucwords
49+
*******************************************************************************/
50+
String.prototype.ucwords = String.prototype.ucwords || function () {
51+
str = this.toLowerCase();
52+
return str.replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g, function (s) { return s.toUpperCase(); });
53+
};

test/js/app.plugin.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
/*******************************************************************************
2-
Application - Plugin - sprintf
3-
*******************************************************************************/
4-
String.prototype.sprintf = String.prototype.sprintf || function (params) {
5-
params = params || [];
6-
7-
var sprintfRegex = /\{(\d+)\}/g;
8-
var sprintf = function (match, number) {
9-
return number in params ? params[number] : match;
10-
};
11-
12-
if (Array.isArray(params) && params.length)
13-
return this.replace(sprintfRegex, sprintf);
14-
else
15-
return this;
16-
};
17-
18-
/*******************************************************************************
19-
Application - Plugin - ucwords
20-
*******************************************************************************/
21-
String.prototype.ucwords = String.prototype.ucwords || function () {
22-
str = this.toLowerCase();
23-
return str.replace(/(^([a-zA-Z\p{M}]))|([ -][a-zA-Z\p{M}])/g, function (s) { return s.toUpperCase(); });
24-
};
25-
261
/*******************************************************************************
272
Application - Plugin - Cookie consent
283
*******************************************************************************/

0 commit comments

Comments
 (0)