Skip to content

Commit 8e33029

Browse files
committed
Update browser files
1 parent 9b71f0d commit 8e33029

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

src/php/strings/sprintf.browser.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
* SOFTWARE.
2222
*/
23-
module.exports = function sprintf () {
23+
function sprintf () {
2424
// discuss at: https://locutus.io/php/sprintf/
2525
// original by: Ash Searle (https://hexmen.com/blog/)
2626
// improved by: Michael White (https://getsprink.com)
@@ -52,21 +52,21 @@ module.exports = function sprintf () {
5252
// example 9: sprintf('%% %2$d', 1, 2)
5353
// returns 9: '% 2'
5454

55-
const regex = /%%|%(?:(\d+)\$)?((?:[-+#0 ]|'[\s\S])*)(\d+)?(?:\.(\d*))?([\s\S])/g
56-
const args = arguments
57-
let i = 0
58-
const format = args[i++]
55+
var regex = /%%|%(?:(\d+)\$)?((?:[-+#0 ]|'[\s\S])*)(\d+)?(?:\.(\d*))?([\s\S])/g
56+
var args = arguments
57+
var i = 0
58+
var format = args[i++]
5959

60-
const _pad = function (str, len, chr, leftJustify) {
60+
var _pad = function (str, len, chr, leftJustify) {
6161
if (!chr) {
6262
chr = ' '
6363
}
64-
const padding = (str.length >= len) ? '' : new Array(1 + len - str.length >>> 0).join(chr)
64+
var padding = (str.length >= len) ? '' : new Array(1 + len - str.length >>> 0).join(chr)
6565
return leftJustify ? str + padding : padding + str
6666
}
6767

68-
const justify = function (value, prefix, leftJustify, minWidth, padChar) {
69-
const diff = minWidth - value.length
68+
var justify = function (value, prefix, leftJustify, minWidth, padChar) {
69+
var diff = minWidth - value.length
7070
if (diff > 0) {
7171
// when padding with zeros
7272
// on the left side
@@ -84,34 +84,34 @@ module.exports = function sprintf () {
8484
return value
8585
}
8686

87-
const _formatBaseX = function (value, base, leftJustify, minWidth, precision, padChar) {
87+
var _formatBaseX = function (value, base, leftJustify, minWidth, precision, padChar) {
8888
// Note: casts negative numbers to positive ones
89-
const number = value >>> 0
89+
var number = value >>> 0
9090
value = _pad(number.toString(base), precision || 0, '0', false)
9191
return justify(value, '', leftJustify, minWidth, padChar)
9292
}
9393

9494
// _formatString()
95-
const _formatString = function (value, leftJustify, minWidth, precision, customPadChar) {
95+
var _formatString = function (value, leftJustify, minWidth, precision, customPadChar) {
9696
if (precision !== null && precision !== undefined) {
9797
value = value.slice(0, precision)
9898
}
9999
return justify(value, '', leftJustify, minWidth, customPadChar)
100100
}
101101

102102
// doFormat()
103-
const doFormat = function (substring, argIndex, modifiers, minWidth, precision, specifier) {
104-
let number, prefix, method, textTransform, value
103+
var doFormat = function (substring, argIndex, modifiers, minWidth, precision, specifier) {
104+
var number, prefix, method, textTransform, value
105105

106106
if (substring === '%%') {
107107
return '%'
108108
}
109109

110110
// parse modifiers
111-
let padChar = ' ' // pad with spaces by default
112-
let leftJustify = false
113-
let positiveNumberPrefix = ''
114-
let j, l
111+
var padChar = ' ' // pad with spaces by default
112+
var leftJustify = false
113+
var positiveNumberPrefix = ''
114+
var j, l
115115

116116
for (j = 0, l = modifiers.length; j < l; j++) {
117117
switch (modifiers.charAt(j)) {

src/php/strings/vsprintf.browser.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,5 @@ function vsprintf (format, args) {
2626
// example 1: vsprintf('%04d-%02d-%02d', [1988, 8, 1])
2727
// returns 1: '1988-08-01'
2828

29-
const sprintf = require('./sprintf')
30-
3129
return sprintf.apply(this, [format].concat(args))
3230
}

0 commit comments

Comments
 (0)