Comparing version 1.2.3 to 1.2.4
@@ -55,18 +55,28 @@ 'use strict'; | ||
// /** Extend with more JSON type definitions (like: base.json). */ | ||
// const extend = (parent, child) => { | ||
// const combined = Object.assign(parent, child) | ||
// const {structs, errors} = create(combined, types) | ||
// return { | ||
// errors, | ||
// structs, | ||
// extend: child => extend(combined, child) | ||
// } | ||
// } | ||
/** Extend with more JSON schema and type definitions */ | ||
var _extend = function _extend(parent, child) { | ||
var combined = Object.assign({}, parent, child); | ||
var _create2 = create(combined, types), | ||
structs = _create2.structs, | ||
errors = _create2.errors; | ||
return { | ||
errors: errors, | ||
structs: structs, | ||
extend: function extend(child) { | ||
return _extend(combined, child); | ||
} | ||
}; | ||
}; | ||
return { | ||
errors: errors, | ||
structs: structs, | ||
types: types | ||
// extend: child => extend(definitions, child) | ||
types: types, | ||
extend: function extend(child) { | ||
return _extend(definitions, child); | ||
} | ||
}; | ||
@@ -73,0 +83,0 @@ }; |
@@ -351,2 +351,8 @@ 'use strict'; | ||
return { amount: amount, symbol: symbol }; | ||
}, | ||
'Asset.toObject': function AssetToObject(value) { | ||
var amount = value.amount, | ||
symbol = value.symbol; | ||
return amount + ' ' + symbol; | ||
} | ||
@@ -362,3 +368,3 @@ }; | ||
assert.deepEqual(asset, { amount: 1, symbol: 'EOS' }); | ||
assert.deepEqual(asset, structs.Asset.toObject(asset)); | ||
assert.deepEqual('1 EOS', structs.Asset.toObject(asset)); | ||
}); | ||
@@ -365,0 +371,0 @@ |
@@ -135,2 +135,10 @@ 'use strict'; | ||
var toObject_struct = config.override[name + '.toObject']; | ||
if (toObject_struct) { | ||
var ret = toObject_struct(serializedObject); | ||
if (ret != null) { | ||
return ret; | ||
} | ||
} | ||
var result = {}; | ||
@@ -137,0 +145,0 @@ var field = null; |
@@ -103,4 +103,4 @@ 'use strict'; | ||
var createTypeReducer = function createTypeReducer(baseTypes) { | ||
return function (map, name) { | ||
map[name] = function () { | ||
return function (customTypes, name) { | ||
customTypes[name] = function () { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
@@ -110,6 +110,6 @@ args[_key] = arguments[_key]; | ||
var type = createType(name, config, args, baseTypes, allTypes); | ||
var type = createType(name, config, args, baseTypes, allTypes, customTypes); | ||
return type; | ||
}; | ||
return map; | ||
return customTypes; | ||
}; | ||
@@ -129,3 +129,3 @@ }; | ||
*/ | ||
function createType(typeName, config, args, baseTypes, allTypes) { | ||
function createType(typeName, config, args, baseTypes, allTypes, customTypes) { | ||
var Type = baseTypes ? allTypes[typeName] : types[typeName]; | ||
@@ -142,3 +142,3 @@ | ||
// if(typeName === 'Vector') console.log('typeName', validation) | ||
var type = fn(validation, baseTypes); | ||
var type = fn(validation, baseTypes, customTypes); | ||
return type; | ||
@@ -145,0 +145,0 @@ } |
{ | ||
"name": "fcbuffer", | ||
"description": "Serialization library geared towards immutable data storage such as blockchains.", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
61170
1573
0