UNPKG

@yellicode/elements

Version:

The meta model API for Yellicode - an extensible code generator.

27 lines (26 loc) 1.05 kB
/* * Copyright (c) 2020 Yellicode * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var regularKeys = ['creator', 'id', 'model', 'modelTypeName', 'modelTypeVersion', 'profiles', 'references']; var DocumentJSONTransformer = /** @class */ (function () { function DocumentJSONTransformer() { } /** * A custom replacer function that is used as a replacer callback using JSON.stringify. * @param {elements.Document} document The document in which the key was found. * @param {any} key The key being stringified. * @param {any} value The value being stringified. */ DocumentJSONTransformer.toJSON = function (document, key, value) { if (value == null) return undefined; if (regularKeys.indexOf(key) > -1) return value; }; return DocumentJSONTransformer; }()); export { DocumentJSONTransformer };