text
stringlengths 0
14.1k
|
---|
0x14, 0x14, 0x14, 0x14, // BlockHeight |
0x15, 0x15, 0x15, 0x15, // BlockIndex |
0x07, // SigScript length |
0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xf2, // Signature script (coinbase) |
} |
// Transaction location information for the test block transactions. |
var testBlockTxLocs = []wire.TxLoc{ |
{TxStart: 181, TxLen: 158}, |
} |
// Transaction location information for the test block stake transactions. |
var testBlockSTxLocs = []wire.TxLoc{ |
{TxStart: 340, TxLen: 158}, |
} |
" isc |
bsander/dJSON test/dJSON.spec.js 3391 "describe('dJSON', function () { |
'use strict'; |
var chai = require('chai'); |
var expect = chai.expect; |
var dJSON = require('../lib/dJSON'); |
var path = 'x.y[""q.{r}""].z'; |
var obj; |
beforeEach(function () { |
obj = { |
x: { |
y: { |
'q.{r}': { |
z: 635 |
}, |
q: { |
r: { |
z: 1 |
} |
} |
} |
}, |
'x-y': 5, |
falsy: false |
}; |
}); |
it('gets a value from an object with a path containing properties which contain a period', function () { |
expect(dJSON.get(obj, path)).to.equal(635); |
expect(dJSON.get(obj, 'x.y.q.r.z')).to.equal(1); |
}); |
it('sets a value from an object with a path containing properties which contain a period', function () { |
dJSON.set(obj, path, 17771); |
expect(dJSON.get(obj, path)).to.equal(17771); |
expect(dJSON.get(obj, 'x.y.q.r.z')).to.equal(1); |
}); |
it('will return undefined when requesting a property with a dash directly', function () { |
expect(dJSON.get(obj, 'x-y')).to.be.undefined; |
}); |
it('will return the proper value when requesting a property with a dash by square bracket notation', function () { |
expect(dJSON.get(obj, '[""x-y""]')).to.equal(5); |
}); |
it('returns a value that is falsy', function () { |
expect(dJSON.get(obj, 'falsy')).to.equal(false); |
}); |
it('sets a value that is falsy', function () { |
dJSON.set(obj, 'new', false); |
expect(dJSON.get(obj, 'new')).to.equal(false); |
}); |
it('uses an empty object as default for the value in the set method', function () { |
var newObj = {}; |
dJSON.set(newObj, 'foo.bar.lorem'); |
expect(newObj).to.deep.equal({ |
foo: { |
bar: { |
lorem: {} |
} |
} |
}); |
}); |
it('does not create an object when a path exists as empty string', function () { |
var newObj = { |
nestedObject: { |
anArray: [ |
'i have a value', |
'' |
] |
} |
}; |
var newPath = 'nestedObject.anArray[1]'; |
dJSON.set(newObj, newPath, 17771); |
expect(newObj).to.deep.equal({ |
nestedObject: { |
anArray: [ |
'i have a value', |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.