Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gun.js
Original file line number Diff line number Diff line change
Expand Up @@ -2094,8 +2094,9 @@

/* BELOW IS TEMPORARY FOR OLD INTERNAL COMPATIBILITY, THEY ARE IMMEDIATELY DEPRECATED AND WILL BE REMOVED IN NEXT VERSION */
;(function(){
var Gun = (typeof window !== 'undefined'? window.Gun : (typeof module !== 'undefined'? module.exports : null)) || (typeof Gun !== 'undefined'? Gun : null);
var u;
if(''+u == typeof Gun){ return }
if(!Gun){ return }
var DEP = function(n){ console.warn("Warning! Deprecated internal utility will break in next version:", n) }
// Generic javascript utilities.
var Type = Gun;
Expand Down
2 changes: 1 addition & 1 deletion gun.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/time.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
;(function(){
var Gun = (typeof window !== "undefined")? window.Gun : require('../gun');
var ify = Gun.node.ify, u;
var ify = (Gun.node && Gun.node.ify) || function(n, s){ return (n = n || {}, n._ = (n._ || {}), n._['#'] = (typeof s === 'string'? s : (s && s.soul)), n) }, u;
Gun.chain.time = function(data, a, b){
if(data instanceof Function){
return travel(data, a, b, this);
Expand Down
25 changes: 25 additions & 0 deletions test/time.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var expect = global.expect || require('./expect');

describe('Time Extension', function(){
it('requires gun/lib/time in nodejs without error', function(){
var Gun = require('../gun');
expect(typeof Gun).to.be('function');
expect(typeof Gun.node).to.be('object');
expect(typeof Gun.node.ify).to.be('function');

expect(function(){
require('../lib/time');
}).to.not.throwException();

expect(typeof Gun.chain.time).to.be('function');
});

it('chains time data onto node', function(){
var Gun = require('../gun');
require('../lib/time');
var gun = Gun({radisk: false, localStorage: false});
var t = gun.get('test_time');
var res = t.time('sample_temporal_data');
expect(res).to.be(t);
});
});