How to use the js-yaml.DEFAULT_FULL_SCHEMA function in js-yaml

To help you get started, we’ve selected a few js-yaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firstandthird / load-grunt-config / lib / readfile.js View on Github external
module.exports = function(file) {

    // check for existence first
    if (!fs.existsSync(file)) {
        throw new Error(file + ' doesn\'t exist');
    }

    var ext = path.extname(file);

    // YAML file
    if (ext.match(/ya?ml/)) {
        var res = fs.readFileSync(file, 'utf8');
        var yaml = require('js-yaml');
        return yaml.safeLoad(res, { schema: yaml.DEFAULT_FULL_SCHEMA });
    }

    // CSON file
    if (ext.match(/cson/)) {
        var cson = require('cson');
        return cson.parseCSONFile(file);
    }

    // JS / JSON / CoffeeScript
    if (ext.match(/json|js|coffee|ls/)) {
        if (!path.isAbsolute(file)) {
            file = path.join(process.cwd(), file);
        }
        return require(file);
    }
github yitzchak / dicy / packages / core / src / File.ts View on Github external
static async readYaml (filePath: string, fullSchema: boolean = true): Promise {
    const contents = await File.read(filePath)
    return yaml.load(contents, {
      schema: fullSchema ? yaml.DEFAULT_FULL_SCHEMA : yaml.DEFAULT_SAFE_SCHEMA
    })
  }
github a-bentofreire / abeamer / shared / dev-config.js View on Github external
function getConfig(projPath) {
        if (!cfg) {
            cfg = yaml.load(fsix_js_1.fsix.readUtf8Sync('./config.yaml'), yaml.DEFAULT_FULL_SCHEMA);
            cfg.paths.PROJ_PATH = fsix_js_1.fsix.toPosixSlash(projPath);
            cfg.release.demosStr = cfg.release.demos.length > 1 ?
                "{" + cfg.release.demos.join(',') + "}" : cfg.release.demos[0];
            expandMap(cfg.webLinks);
            expandMap(cfg.paths);
        }
        return cfg;
    }
    DevCfg.getConfig = getConfig;
github a-bentofreire / abeamer / shared / dev-config.ts View on Github external
export function getConfig(projPath: string): DevCfg.DevConfig {
    if (!cfg) {
      cfg = yaml.load(fsix.readUtf8Sync('./config.yaml'), yaml.DEFAULT_FULL_SCHEMA);
      cfg.paths.PROJ_PATH = fsix.toPosixSlash(projPath);
      cfg.release.demosStr = cfg.release.demos.length > 1 ?
        `{${cfg.release.demos.join(',')}}` : cfg.release.demos[0];

      expandMap(cfg.webLinks);
      expandMap(cfg.paths);
    }
    return cfg;
  }
github blake-regalia / linked-data.syntaxes / src / class / syntax.js View on Github external
serialize_sublime_syntax(g_def={}) {
		return `%YAML 1.2\n---\n${yaml.safeDump({
			...this.other,
			...g_def,
			name: this.name,
			variables: this.export_variables(),
			contexts: Object.entries(this.contexts)
				.reduce((h_contexts, [si_context, k_context]) => ({
					...h_contexts,
					[si_context]: k_context.export(),
				}), {}),
		}, {
			noRefs: true,
			noCompatMode: true,
			lineWidth: 600,
			schema: yaml.DEFAULT_FULL_SCHEMA,
		})}`;
	}