Skip to content

Commit

Permalink
Fixed an issue with the utils.
Browse files Browse the repository at this point in the history
Stable Version 1.0.0-alpha.1-2.
  • Loading branch information
jmdobry committed Oct 31, 2014
1 parent 19ebccb commit 95d2979
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
##### 1.0.0-alpha.1-2 - 30 October 2014

###### Backwards compatible bug fixes
- Fixed an issue with the options defaults util function

##### 1.0.0-alpha.1-1 - 19 October 2014

###### Backwards compatible API changes
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "1.0.0-alpha.1-1",
"version": "1.0.0-alpha.1-2",
"homepage": "http://www.js-data.io",
"repository": {
"type": "git",
Expand Down
11 changes: 6 additions & 5 deletions dist/js-data.js
@@ -1,7 +1,7 @@
/**
* @author Jason Dobry <jason.dobry@gmail.com>
* @file js-data.js
* @version 1.0.0-alpha.1-1 - Homepage <http://www.js-data.io/>
* @version 1.0.0-alpha.1-2 - Homepage <http://www.js-data.io/>
* @copyright (c) 2014 Jason Dobry
* @license MIT <https://github.com/js-data/js-data/blob/master/LICENSE>
*
Expand Down Expand Up @@ -5019,6 +5019,7 @@ module.exports = {
upperCase: require('mout/string/upperCase'),
pascalCase: require('mout/string/pascalCase'),
deepMixIn: require('mout/object/deepMixIn'),
mixIn: require('mout/object/mixIn'),
forOwn: require('mout/object/forOwn'),
forEach: require('mout/array/forEach'),
pick: require('mout/object/pick'),
Expand All @@ -5040,12 +5041,12 @@ module.exports = {
throw new DSErrors.IA('"options" must be an object!');
}
_this.forEach(toPromisify, function (name) {
if (typeof options[name] === 'function') {
option[name] = _this.promisify(options[name]);
if (typeof options[name] === 'function' && options[name].toString().indexOf('var args = Array') === -1) {
options[name] = _this.promisify(options[name]);
}
});
var O = function Options(attrs) {
_this.deepMixIn(this, attrs);
_this.mixIn(this, attrs);
};
O.prototype = parent;
return new O(options);
Expand Down Expand Up @@ -5160,5 +5161,5 @@ module.exports = {
Events: Events
};

},{"./errors":67,"es6-promise":2,"mout/array/contains":4,"mout/array/filter":5,"mout/array/forEach":6,"mout/array/remove":9,"mout/array/slice":10,"mout/array/sort":11,"mout/array/toLookup":12,"mout/lang/isArray":18,"mout/lang/isBoolean":19,"mout/lang/isEmpty":20,"mout/lang/isFunction":21,"mout/lang/isNumber":23,"mout/lang/isObject":24,"mout/lang/isString":26,"mout/object/deepMixIn":30,"mout/object/forOwn":32,"mout/object/merge":34,"mout/object/pick":37,"mout/object/set":38,"mout/string/makePath":41,"mout/string/pascalCase":42,"mout/string/upperCase":45}]},{},[68])(68)
},{"./errors":67,"es6-promise":2,"mout/array/contains":4,"mout/array/filter":5,"mout/array/forEach":6,"mout/array/remove":9,"mout/array/slice":10,"mout/array/sort":11,"mout/array/toLookup":12,"mout/lang/isArray":18,"mout/lang/isBoolean":19,"mout/lang/isEmpty":20,"mout/lang/isFunction":21,"mout/lang/isNumber":23,"mout/lang/isObject":24,"mout/lang/isString":26,"mout/object/deepMixIn":30,"mout/object/forOwn":32,"mout/object/merge":34,"mout/object/mixIn":35,"mout/object/pick":37,"mout/object/set":38,"mout/string/makePath":41,"mout/string/pascalCase":42,"mout/string/upperCase":45}]},{},[68])(68)
});
4 changes: 2 additions & 2 deletions dist/js-data.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "js-data",
"description": "Robust, framework-agnostic in-memory data store.",
"version": "1.0.0-alpha.1-1",
"version": "1.0.0-alpha.1-2",
"homepage": "http://www.js-data.io",
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions src/utils.js
Expand Up @@ -211,6 +211,7 @@ module.exports = {
upperCase: require('mout/string/upperCase'),
pascalCase: require('mout/string/pascalCase'),
deepMixIn: require('mout/object/deepMixIn'),
mixIn: require('mout/object/mixIn'),
forOwn: require('mout/object/forOwn'),
forEach: require('mout/array/forEach'),
pick: require('mout/object/pick'),
Expand All @@ -232,12 +233,12 @@ module.exports = {
throw new DSErrors.IA('"options" must be an object!');
}
_this.forEach(toPromisify, function (name) {
if (typeof options[name] === 'function') {
option[name] = _this.promisify(options[name]);
if (typeof options[name] === 'function' && options[name].toString().indexOf('var args = Array') === -1) {
options[name] = _this.promisify(options[name]);
}
});
var O = function Options(attrs) {
_this.deepMixIn(this, attrs);
_this.mixIn(this, attrs);
};
O.prototype = parent;
return new O(options);
Expand Down
3 changes: 1 addition & 2 deletions test/both/datastore/sync_methods/lastModified.test.js
Expand Up @@ -4,7 +4,7 @@ describe('DS#lastModified', function () {
store.lastModified('does not exist', {});
}, store.errors.NonexistentResourceError, 'does not exist is not a registered resource!');
});
it('should lastModified an item into the store', function () {
it('should update lastModified when an item is injected into the store', function () {

var collectionLastModified;

Expand Down Expand Up @@ -38,7 +38,6 @@ describe('DS#lastModified', function () {

assert.notEqual(store.lastModified('post'), collectionLastModified);

collectionLastModified = store.lastModified('post');
assert.equal(store.lastModified('post', 5), lastModified);
});
// it('should lastModified an item into the store', function (done) {
Expand Down
36 changes: 36 additions & 0 deletions test/browser/datastore/sync_methods/lastModified.test.js
@@ -0,0 +1,36 @@
describe('DS#lastModified', function () {
it('should update lastModified when top-level "own" properties change', function (done) {

var Thing = store.defineResource('thing');

var thing = Thing.inject({ id: 1, foo: 'bar', bing: { boom: 'bam' } });
var time = Thing.lastModified(1);

thing.foo = 'baz';
if (typeof Object.observe !== 'function') {
Thing.digest();
}
setTimeout(function () {
try {
assert.notEqual(time, Thing.lastModified(1));
time = Thing.lastModified(1);
thing.bing.boom = 'kazaam';
if (typeof Object.observe !== 'function') {
Thing.digest();
}
setTimeout(function () {
try {
assert.equal(time, Thing.lastModified(1));
done();
} catch (e) {
console.log(e.stack);
done(e);
}
}, 100);
} catch (e) {
console.log(e.stack);
done(e);
}
}, 100);
});
});

0 comments on commit 95d2979

Please sign in to comment.