How to use the uuid58.to58 function in uuid58

To help you get started, we’ve selected a few uuid58 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 sagefy / sagefy / client / index.js View on Github external
app.get('/next', async (req, res) => {
  const role = getRole(req)
  const defaultUrl = role === 'sg_anonymous' ? '/subjects/search' : '/dashboard'
  if (!req.query.goal && !req.cookies.goal) {
    return res.redirect(defaultUrl)
  }
  // ?goal => query.goal, undefined
  // ?step => cookie.goal, query.step
  // ?____ => cookie.goal, cookie.step
  const gqlRes = await GQL.next(req, {
    goal: toU(req.query.goal || req.cookies.goal),
    step: req.query.goal ? undefined : toU(req.query.step || req.cookies.step),
  })
  const { next, step, goal, kind, card } = get(gqlRes, 'next.nextPage')
  res.cookie('goal', to58(goal), LEARN_COOKIE_PARAMS)
  if (step) res.cookie('step', to58(step), LEARN_COOKIE_PARAMS)
  else res.clearCookie('step')
  const kindUrl = get(CARD_KIND, [kind, 'url'])
  const urlMap = {
    CREATE_CARD: `/cards/create?subjectId=${to58(step)}`,
    LEARN_CARD: `/${kindUrl}-cards/${to58(card)}/learn`,
    COMPLETE_SUBJECT: `/subjects/${to58(goal)}/complete`,
    CHOOSE_STEP: `/subjects/${to58(goal)}/steps`,
  }
  return res.redirect(get(urlMap, next, defaultUrl))
})
github sagefy / sagefy / client / index.js View on Github external
app.get('/next', async (req, res) => {
  const role = getRole(req)
  const defaultUrl = role === 'sg_anonymous' ? '/subjects/search' : '/dashboard'
  if (!req.query.goal && !req.cookies.goal) {
    return res.redirect(defaultUrl)
  }
  // ?goal => query.goal, undefined
  // ?step => cookie.goal, query.step
  // ?____ => cookie.goal, cookie.step
  const gqlRes = await GQL.next(req, {
    goal: toU(req.query.goal || req.cookies.goal),
    step: req.query.goal ? undefined : toU(req.query.step || req.cookies.step),
  })
  const { next, step, goal, kind, card } = get(gqlRes, 'next.nextPage')
  res.cookie('goal', to58(goal), LEARN_COOKIE_PARAMS)
  if (step) res.cookie('step', to58(step), LEARN_COOKIE_PARAMS)
  else res.clearCookie('step')
  const kindUrl = get(CARD_KIND, [kind, 'url'])
  const urlMap = {
    CREATE_CARD: `/cards/create?subjectId=${to58(step)}`,
    LEARN_CARD: `/${kindUrl}-cards/${to58(card)}/learn`,
    COMPLETE_SUBJECT: `/subjects/${to58(goal)}/complete`,
    CHOOSE_STEP: `/subjects/${to58(goal)}/steps`,
  }
  return res.redirect(get(urlMap, next, defaultUrl))
})
github sagefy / sagefy / client / views / components / Topic.jsx View on Github external
export default function Topic({
  id,
  created,
  name,
  postsByTopicId,
  gqlErrors,
  query,
  body,
}) {
  const selected = query['topic-id'] === to58(id)
  return (
    <li id="{`topic-${to58(id)}`}">
      <details open="{selected}">
        <summary>
          <h3>{name}</h3> {/* if author, edit name */}
          <small>
            
          </small>
        </summary>
        {postsByTopicId.nodes.length ? (
          
            {postsByTopicId.nodes.map(post =&gt; (
              
            ))}
          <table></table>
        ) : (
          <p>
            <em>There's no posts yet. Be the first!</em></p></details></li>
github sagefy / sagefy / client / views / components / Topic.jsx View on Github external
export default function Topic({
  id,
  created,
  name,
  postsByTopicId,
  gqlErrors,
  query,
  body,
}) {
  const selected = query['topic-id'] === to58(id)
  return (
    <li id="{`topic-${to58(id)}`}">
      <details open="{selected}">
        <summary>
          <h3>{name}</h3> {/* if author, edit name */}
          <small>
            
          </small>
        </summary>
        {postsByTopicId.nodes.length ? (
          
            {postsByTopicId.nodes.map(post =&gt; (
              
            ))}
          <table></table>
        ) : (</details></li>
github sagefy / sagefy / client / views / components / TempHelp.jsx View on Github external
export default function TempHelp({ name, cardId, subjectId }) {
  if (SKIPLIST.includes(to58(subjectId)) || !name || !cardId) return &lt;&gt;
  return (
    <section>
      <hr>
      <p>
        <small>
          Sagefy currently shows computer-made examples of many subjects. <br>
           If you want to learn about <q>{name}</q> and
          help others learn too,{' '}
          <a href="{`/cards/${to58(cardId)}/edit?redirect=/cards/${to58(">
             help us by editing!
          </a>
        </small></p></section>
github sagefy / sagefy / client / index.js View on Github external
async (req, res) => {
    try {
      const gqlRes = await GQL.createTopic(req, req.body)
      const topicId = to58(get(gqlRes, 'createTopic.topic.id'))
      return res.redirect(`?topic-id=${topicId}#topic-${topicId}`)
    } catch (e) {
      return res.redirect('')
    }
  }
)
github sagefy / sagefy / client / index.js View on Github external
async (req, res) => {
    try {
      const gqlRes = await GQL.createPost(req, req.body)
      return res.redirect(
        `..?topic-id=${req.params.topicId}#post-${to58(
          get(gqlRes, 'createPost.post.id')
        )}`
      )
    } catch (e) {
      return res.redirect(`..?topic-id=${req.params.topicId}`)
    }
  }
)
github sagefy / sagefy / client / views / StatisticsPage.jsx View on Github external
({ entityId, name }) =&gt; (
              <li>
                <a href="{`/subjects/${to58(entityId)}`}">{name}</a>
              </li>
            )
          )}
github sagefy / sagefy / client / views / components / ListOfCards.jsx View on Github external
{kCards.map(({ name, entityId }) =&gt; (
          <li>
            <a href="{`/${get(CARD_KIND,">
              {name}
            </a>
          </li>
        ))}
github sagefy / sagefy / client / views / DashboardPage.jsx View on Github external
{mySubjects.map(({ entityId, name, cardCount, childCount }) =&gt; (
                <li>
                  <a href="{`/cards/create?subjectId=${to58(entityId)}`}">
                    Add cards to <q>{name}</q>
                  </a>{' '}
                  <small>
                    ({cardCount} cards, {childCount} child subjects)
                  </small>
                </li>
              ))}

uuid58

Convert UUID -> base58 and base58 -> UUID

Apache-2.0
Latest version published 5 years ago

Package Health Score

42 / 100
Full package analysis

Popular uuid58 functions