UNPKG

1.44 kBSource Map (JSON)View Raw
1{"version":3,"file":"ta-json-number-converter.js","sourceRoot":"","sources":["../../../../src/_utils/ta-json-number-converter.ts"],"names":[],"mappings":";;;AASA;IAAA;IAcA,CAAC;IAbU,uCAAS,GAAhB,UAAiB,QAAyB;QAEtC,OAAO,CAAC,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxE,CAAC;IAEM,yCAAW,GAAlB,UAAmB,KAAgB;QAE/B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAEM,yDAA2B,GAAlC;QACI,OAAO,KAAK,CAAC;IACjB,CAAC;IACL,0BAAC;AAAD,CAAC,AAdD,IAcC;AAdY,kDAAmB","sourcesContent":["// ==LICENSE-BEGIN==\n// Copyright 2017 European Digital Reading Lab. All rights reserved.\n// Licensed to the Readium Foundation under one or more contributor license agreements.\n// Use of this source code is governed by a BSD-style license\n// that can be found in the LICENSE file exposed on Github (readium) in the project repository.\n// ==LICENSE-END==\n\nimport { IPropertyConverter, JsonValue } from \"ta-json-x\";\n\nexport class JsonNumberConverter implements IPropertyConverter {\n public serialize(property: number | string): JsonValue {\n // parseFloat() vs. Number()\n return (typeof property === \"string\") ? Number(property) : property;\n }\n\n public deserialize(value: JsonValue): number {\n // return (typeof value === \"string\") ? Number(value) : value;\n return Number(value);\n }\n\n public collapseArrayWithSingleItem(): boolean {\n return false;\n }\n}\n"]}
\No newline at end of file