Skip to content

Commit a052cd5

Browse files
committed
3.2.0
1 parent 2f60f20 commit a052cd5

File tree

7 files changed

+23
-7
lines changed

7 files changed

+23
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
3.2.0 / 2015-06-02
2+
---------------------
3+
- added `titleCase()` method [#149](https://github.com/jprichardson/string.js/pull/149)
4+
- fix `underscore()` [#148](https://github.com/jprichardson/string.js/pull/148)
5+
16
3.1.3 / 2015-05-29
27
--------------------
38
- fix [#142](https://github.com/jprichardson/string.js/issues/142)

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "string",
3-
"version": "3.1.3",
3+
"version": "3.2.0",
44
"description": "string contains methods that aren't included in the vanilla JavaScript string such as escaping HTML, decoding HTML entities, stripping tags, etc.",
55
"keywords": [
66
"string",

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "string.js",
3-
"version": "3.1.3",
3+
"version": "3.2.0",
44
"description": "string contains methods that aren't included in the vanilla JavaScript string such as escaping HTML, decoding HTML entities, stripping tags, etc.",
55
"repo": "jprichardson/string.js",
66
"keywords": [

dist/string.js

Lines changed: 14 additions & 2 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.3';
23+
var VERSION = '3.2.0';
2424

2525
var ENTITIES = {};
2626

@@ -466,6 +466,18 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
466466
times: function(n) {
467467
return new this.constructor(new Array(n + 1).join(this.s));
468468
},
469+
470+
titleCase: function() {
471+
var s = this.s;
472+
if (s) {
473+
s = s.replace(/(^[a-z]| [a-z]|-[a-z]|_[a-z])/g,
474+
function($1){
475+
return $1.toUpperCase();
476+
}
477+
);
478+
}
479+
return new this.constructor(s);
480+
},
469481

470482
toBoolean: function() {
471483
if (typeof this.orig === 'string') {
@@ -605,7 +617,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
605617

606618
//#modified from https://github.com/epeli/underscore.string
607619
underscore: function() {
608-
var s = this.trim().s.replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/([A-Z\d]+)([A-Z][a-z])/,'$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
620+
var s = this.trim().s.replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/([A-Z\d]+)([A-Z][a-z])/g,'$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
609621
return new this.constructor(s);
610622
},
611623

dist/string.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
55
!(function() {
66
"use strict";
77

8-
var VERSION = '3.1.3';
8+
var VERSION = '3.2.0';
99

1010
var ENTITIES = {};
1111

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "string",
3-
"version": "3.1.3",
3+
"version": "3.2.0",
44
"description": "string contains methods that aren't included in the vanilla JavaScript string such as escaping html, decoding html entities, stripping tags, etc.",
55
"homepage": "http://stringjs.com",
66
"repository": {

0 commit comments

Comments
 (0)