Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

short-versions.js 746 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  1. // This module creates shortcuts for version comparisons in Liquid conditional strings.
  2. //
  3. // Supported:
  4. // {% if fpt %}
  5. // {% if ghae %}
  6. // {% if ghes %}
  7. //
  8. // For the custom operator handling in statements like {% if ghes > 3.0 %}, see `lib/liquid-tags/if-ver.js`.
  9. module.exports = async function shortVersions (req, res, next) {
  10. const { allVersions, currentVersion } = req.context
  11. const currentVersionObj = allVersions[currentVersion]
  12. if (!currentVersionObj) return next()
  13. // Add the short name to context.
  14. req.context[currentVersionObj.shortName] = true
  15. // Add convenience props.
  16. req.context.currentRelease = currentVersion.split('@')[1]
  17. req.context.currentVersionShortName = currentVersionObj.shortName
  18. return next()
  19. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...