Skip to content

Commit eea7df4

Browse files
committed
Merge pull request #52 from teamsnap/fix-sort-null
Account for null sort value
2 parents 7bed75b + 7528784 commit eea7df4

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

lib/teamsnap.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ exports.getAssignmentSort = function(reverse) {
387387
valueA = _this.memberName(itemA.member, reverse).toLowerCase();
388388
valueB = _this.memberName(itemB.member, reverse).toLowerCase();
389389
}
390-
if (typeof valueA.localeCompare === 'function') {
390+
if (typeof (valueA != null ? valueA.localeCompare : void 0) === 'function') {
391391
return valueA.localeCompare(valueB);
392392
} else {
393393
if (valueA === valueB) {
@@ -1693,7 +1693,7 @@ exports.getMemberSort = function(reverse) {
16931693
valueA = _this.memberName(itemA, reverse, true).toLowerCase();
16941694
valueB = _this.memberName(itemB, reverse, true).toLowerCase();
16951695
}
1696-
if (typeof valueA.localeCompare === 'function') {
1696+
if (typeof (valueA != null ? valueA.localeCompare : void 0) === 'function') {
16971697
return valueA.localeCompare(valueB);
16981698
} else {
16991699
if (valueA === valueB) {
@@ -4715,7 +4715,7 @@ TeamSnap.prototype.getNameSort = function() {
47154715
valueB = itemB.id;
47164716
}
47174717
}
4718-
if (typeof valueA.localeCompare === 'function') {
4718+
if (typeof (valueA != null ? valueA.localeCompare : void 0) === 'function') {
47194719
return valueA.localeCompare(valueB);
47204720
} else {
47214721
if (valueA === valueB) {
@@ -4750,7 +4750,7 @@ TeamSnap.prototype.getDefaultSort = function() {
47504750
valueB = itemB.id;
47514751
}
47524752
}
4753-
if (typeof valueA.localeCompare === 'function') {
4753+
if (typeof (valueA != null ? valueA.localeCompare : void 0) === 'function') {
47544754
return valueA.localeCompare(valueB);
47554755
} else {
47564756
if (valueA === valueB) {
@@ -4942,7 +4942,7 @@ ref = require('./model'), Collection = ref.Collection, Item = ref.Item;
49424942
require('./errors');
49434943

49444944
TeamSnap = (function() {
4945-
TeamSnap.prototype.version = '1.4.1';
4945+
TeamSnap.prototype.version = '1.5.1';
49464946

49474947
TeamSnap.prototype.promises = promises;
49484948

lib/teamsnap.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "teamsnap.js",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"description": "A JavaScript library for using the TeamSnap API.",
55
"author": "Jacob Wright with TeamSnap (http://www.teamsnap.com)",
66
"homepage": "https://github.com/teamsnap/teamsnap-javascript-sdk",

src/collections/assignments.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ exports.getAssignmentSort = (reverse) ->
5151
valueA = @memberName(itemA.member, reverse).toLowerCase()
5252
valueB = @memberName(itemB.member, reverse).toLowerCase()
5353
# Let's try to use `localeCompare()` if available
54-
if typeof valueA.localeCompare is 'function'
54+
if typeof valueA?.localeCompare is 'function'
5555
valueA.localeCompare valueB
5656
else
5757
if valueA is valueB then 0

src/collections/members.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ exports.getMemberSort = (reverse) ->
116116
valueA = @memberName(itemA, reverse, true).toLowerCase()
117117
valueB = @memberName(itemB, reverse, true).toLowerCase()
118118
# Let's try to use `localeCompare()` if available
119-
if typeof valueA.localeCompare is 'function'
119+
if typeof valueA?.localeCompare is 'function'
120120
valueA.localeCompare valueB
121121
else
122122
if valueA is valueB then 0

src/sdk.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ TeamSnap::getNameSort = ->
9898
valueA = itemA.id
9999
valueB = itemB.id
100100
# Let's try to use `localeCompare()` if available
101-
if typeof valueA.localeCompare is 'function'
101+
if typeof valueA?.localeCompare is 'function'
102102
valueA.localeCompare valueB
103103
else
104104
if valueA is valueB then 0
@@ -122,7 +122,7 @@ TeamSnap::getDefaultSort = ->
122122
valueA = itemA.id
123123
valueB = itemB.id
124124
# Let's try to use `localeCompare()` if available
125-
if typeof valueA.localeCompare is 'function'
125+
if typeof valueA?.localeCompare is 'function'
126126
valueA.localeCompare valueB
127127
else
128128
if valueA is valueB then 0

src/teamsnap.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ promises = require './promises'
33
require './errors'
44

55
class TeamSnap
6-
version: '1.5.0'
6+
version: '1.5.1'
77
promises: promises
88
when: promises.when
99
TeamSnap: TeamSnap

0 commit comments

Comments
 (0)