How to use the js-yaml.stringify 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 OfficeDev / script-lab / client / src / store / gists / sagas.ts View on Github external
function* createGistSaga(action: ActionType) {
  const token = yield select(selectors.github.getToken)
  if (!token) {
    return
  }

  const solution: ISolution = yield select(
    selectors.solutions.get,
    action.payload.solutionId,
  )

  const snippet = YAML.stringify(convertSolutionToSnippet(solution))

  const { response, error } = yield call(github.request, {
    method: 'POST',
    path: 'gists',
    token,
    jsonPayload: JSON.stringify({
      public: action.payload.isPublic,
      description: `${solution.description}`,
      files: {
        [`${solution.name}.yaml`]: {
          content: snippet,
        },
      },
    }),
  })
github OfficeDev / script-lab / client / src / store / gists / sagas.ts View on Github external
function* updateGistSaga(action: ActionType) {
  const token = yield select(selectors.github.getToken)
  if (!token) {
    return
  }

  const solution = yield select(selectors.solutions.get, action.payload.solutionId)
  const snippet = YAML.stringify(convertSolutionToSnippet(solution))
  const gistId = solution.source.id

  if (!gistId) {
    yield put(gists.update.failure(new Error('No gistId for this solution.')))
  } else {
    const { response, error } = yield call(github.request, {
      method: 'PATCH',
      path: `gists/${gistId}`,
      token,
      jsonPayload: JSON.stringify({
        description: `${solution.description}`,
        files: {
          [`${solution.name}.yaml`]: {
            content: snippet,
          },
        },
github OfficeDev / script-lab / client / src / components / Header / index.tsx View on Github external
getSnippetYaml = (): string =>
    YAML.stringify(convertSolutionToSnippet(this.props.solution))