-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from stoplightio/fix/no-stoplight-packages
Do not use Stoplight packages
- Loading branch information
Showing
12 changed files
with
96 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint lines-around-comment: [2, {beforeBlockComment: false}] */ | ||
"use strict"; | ||
|
||
const yaml = require("js-yaml"); | ||
const { ono } = require("@jsdevtools/ono"); | ||
|
||
/** | ||
* Simple YAML parsing functions, similar to {@link JSON.parse} and {@link JSON.stringify} | ||
*/ | ||
module.exports = { | ||
/** | ||
* Parses a YAML string and returns the value. | ||
* | ||
* @param {string} text - The YAML string to be parsed | ||
* @param {function} [reviver] - Not currently supported. Provided for consistency with {@link JSON.parse} | ||
* @returns {*} | ||
*/ | ||
parse (text, reviver) { | ||
return yaml.safeLoad(text); | ||
}, | ||
|
||
/** | ||
* Converts a JavaScript value to a YAML string. | ||
* | ||
* @param {*} value - The value to convert to YAML | ||
* @param {function|array} replacer - Not currently supported. Provided for consistency with {@link JSON.stringify} | ||
* @param {string|number} space - The number of spaces to use for indentation, or a string containing the number of spaces. | ||
* @returns {string} | ||
*/ | ||
stringify (value, replacer, space) { | ||
let indent = (typeof space === "string" ? space.length : space) || 2; | ||
return yaml.safeDump(value, { indent }); | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.