Skip to content

Commit 8e67a50

Browse files
committed
fix extendPrototype method
1 parent 772ba10 commit 8e67a50

File tree

4 files changed

+19
-21
lines changed

4 files changed

+19
-21
lines changed

dist/string.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
2020
!(function() {
2121
"use strict";
2222

23-
var VERSION = '3.1.0';
23+
var VERSION = '3.1.1';
2424

2525
var ENTITIES = {};
2626

@@ -81,11 +81,11 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
8181
var s = this.s;
8282
var startPos = s.indexOf(left);
8383
var endPos = s.indexOf(right, startPos + left.length);
84-
if (endPos == -1 && right != null)
84+
if (endPos == -1 && right != null)
8585
return new this.constructor('')
8686
else if (endPos == -1 && right == null)
8787
return new this.constructor(s.substring(startPos + left.length))
88-
else
88+
else
8989
return new this.constructor(s.slice(startPos + left.length, endPos));
9090
},
9191

@@ -161,7 +161,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
161161
.replace(/&([^;\W]+;?)/g, function (m, e) {
162162
var ee = e.replace(/;$/, '');
163163
var target = ENTITIES[e] || (e.match(/;$/) && ENTITIES[ee]);
164-
164+
165165
if (typeof target === 'number') {
166166
return String.fromCharCode(target);
167167
}
@@ -246,7 +246,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
246246
return this.right(-N);
247247
}
248248
},
249-
249+
250250
lines: function() { //convert windows newlines to unix newlines then convert to an Array of lines
251251
return this.replaceAll('\r\n', '\n').s.split('\n');
252252
},
@@ -490,9 +490,9 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
490490

491491
trim: function() {
492492
var s;
493-
if (typeof __nsp.trim === 'undefined')
493+
if (typeof __nsp.trim === 'undefined')
494494
s = this.s.replace(/(^\s*|\s*$)/g, '')
495-
else
495+
else
496496
s = this.s.trim()
497497
return new this.constructor(s);
498498
},
@@ -576,19 +576,19 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
576576
var shouldQualify = hasVal(qualifier)
577577
if (typeof dataArray[i] == 'number')
578578
shouldQualify &= encloseNumbers;
579-
579+
580580
if (shouldQualify)
581581
buildString.push(qualifier);
582-
582+
583583
if (dataArray[i] !== null && dataArray[i] !== undefined) {
584584
var d = new S(dataArray[i]).replaceAll(qualifier, rep).s;
585585
buildString.push(d);
586-
} else
586+
} else
587587
buildString.push('')
588588

589589
if (shouldQualify)
590590
buildString.push(qualifier);
591-
591+
592592
if (delim)
593593
buildString.push(delim);
594594
}
@@ -717,7 +717,8 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
717717
var name = names[i];
718718
var func = __nsp[name];
719719
try {
720-
var type = typeof func.apply('teststring', []);
720+
// #127: pass extra parameter to keep shelljs happy
721+
var type = typeof func.apply('test', ['string']);
721722
retObj[name] = type;
722723
} catch (e) {}
723724
}

0 commit comments

Comments
 (0)