Skip to content

Commit

Permalink
Fixed defects related to lodash 4.x upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ifandelse committed Apr 30, 2016
1 parent daa0ca4 commit 8e9848d
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![](logo/postaljs.jpg "Special Thanks to Derick Bailey for the postal logo!")

## Version 1.0.9 ([MIT](http://www.opensource.org/licenses/mit-license))
## Version 1.0.10 ([MIT](http://www.opensource.org/licenses/mit-license))

> See the [changelog](https://github.com/postaljs/postal.js/blob/master/changelog.md) for information on if the current version of postal has breaking changes compared to any older version(s) you might be using. Version 0.11+ removed the dependency on ConduitJS and significantly improved publishing performance. Version 1.0+ added an optional embedded-and-customized-lodash build.
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.0.10
* Fixed issue where removed lodash alias was still in use
* Fixed issue `this` context issue in postal.subscribe

## v1.0.9
* Merged #148 - Updated to lodash 4.x
* Merged #128 - Remove unused bower.json version prop
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "postal.js",
"repo": "postaljs/postal.js",
"description": "Client-side messaging library",
"version": "1.0.9",
"version": "1.0.10",
"keywords": [
"pub/sub",
"pub",
Expand Down
11 changes: 6 additions & 5 deletions lib/postal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* postal - Pub/Sub library providing wildcard subscriptions, complex message handling, etc. Works server and client-side.
* Author: Jim Cowart (http://ifandelse.com)
* Version: v1.0.9
* Version: v1.0.10
* Url: http://github.com/postaljs/postal.js
* License(s): MIT
*/
Expand Down Expand Up @@ -106,7 +106,7 @@ var ConsecutiveDistinctPredicate = function() {
var DistinctPredicate = function DistinctPredicateFactory() {
var previous = [];
return function DistinctPredicate( data ) {
var isDistinct = !_.any( previous, function( p ) {
var isDistinct = !_.some( previous, function( p ) {
return _.isEqual( data, p );
} );
if ( isDistinct ) {
Expand Down Expand Up @@ -601,14 +601,15 @@ _.extend( postal, {
// First, add the SubscriptionDefinition to the channel list
subs.push( subDef );
// Next, add the SubscriptionDefinition to any relevant existing cache(s)
_.each( _.keys( this.cache ), function( cacheKey ) {
var cache = this.cache;
_.each( _.keys( cache ), function( cacheKey ) {
if ( cacheKey.substr( 0, channelLen ) === subDef.channel ) {
getCacher(
cacheKey.split( _config.cacheKeyDelimiter )[1],
this.cache,
cache,
cacheKey )( subDef );
}
}, this );
} );

if ( _config.enableSystemMessages ) {
this.publish( sysCreatedMessage( subDef ) );
Expand Down
11 changes: 6 additions & 5 deletions lib/postal.lodash.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* postal - Pub/Sub library providing wildcard subscriptions, complex message handling, etc. Works server and client-side.
* Author: Jim Cowart (http://ifandelse.com)
* Version: v1.0.9
* Version: v1.0.10
* Url: http://github.com/postaljs/postal.js
* License(s): MIT
*/
Expand Down Expand Up @@ -129,7 +129,7 @@ var ConsecutiveDistinctPredicate = function() {
var DistinctPredicate = function DistinctPredicateFactory() {
var previous = [];
return function DistinctPredicate( data ) {
var isDistinct = !_.any( previous, function( p ) {
var isDistinct = !_.some( previous, function( p ) {
return _.isEqual( data, p );
} );
if ( isDistinct ) {
Expand Down Expand Up @@ -624,14 +624,15 @@ _.extend( postal, {
// First, add the SubscriptionDefinition to the channel list
subs.push( subDef );
// Next, add the SubscriptionDefinition to any relevant existing cache(s)
_.each( _.keys( this.cache ), function( cacheKey ) {
var cache = this.cache;
_.each( _.keys( cache ), function( cacheKey ) {
if ( cacheKey.substr( 0, channelLen ) === subDef.channel ) {
getCacher(
cacheKey.split( _config.cacheKeyDelimiter )[1],
this.cache,
cache,
cacheKey )( subDef );
}
}, this );
} );

if ( _config.enableSystemMessages ) {
this.publish( sysCreatedMessage( subDef ) );
Expand Down
4 changes: 2 additions & 2 deletions lib/postal.lodash.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/postal.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "postal",
"description": "Pub/Sub library providing wildcard subscriptions, complex message handling, etc. Works server and client-side.",
"version": "1.0.9",
"version": "1.0.10",
"homepage": "http://github.com/postaljs/postal.js",
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions src/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,15 @@ _.extend( postal, {
// First, add the SubscriptionDefinition to the channel list
subs.push( subDef );
// Next, add the SubscriptionDefinition to any relevant existing cache(s)
_.each( _.keys( this.cache ), function( cacheKey ) {
var cache = this.cache;
_.each( _.keys( cache ), function( cacheKey ) {
if ( cacheKey.substr( 0, channelLen ) === subDef.channel ) {
getCacher(
cacheKey.split( _config.cacheKeyDelimiter )[1],
this.cache,
cache,
cacheKey )( subDef );
}
}, this );
} );
/* istanbul ignore else */
if ( _config.enableSystemMessages ) {
this.publish( sysCreatedMessage( subDef ) );
Expand Down
2 changes: 1 addition & 1 deletion src/SubscriptionDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var ConsecutiveDistinctPredicate = function() {
var DistinctPredicate = function DistinctPredicateFactory() {
var previous = [];
return function DistinctPredicate( data ) {
var isDistinct = !_.any( previous, function( p ) {
var isDistinct = !_.some( previous, function( p ) {
return _.isEqual( data, p );
} );
if ( isDistinct ) {
Expand Down

0 comments on commit 8e9848d

Please sign in to comment.