PluginProbe
Extendify / 0.9.3
Extendify v0.9.3
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Onboarding / lib / util.js

util.js in Extendify 0.9.3, at src/Onboarding/lib/util.js

19 lines 747 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /** Takes each possible code section and filters out undefined */
2 export const findTheCode = (item) =>
3 [item?.template?.code, item?.template?.code2].filter(Boolean).join('')
4
5 /** Removes any hash or qs values from URL - Airtable adds timestamps */
6 export const stripUrlParams = (url) => url?.[0]?.url?.split(/[?#]/)?.[0]
7
8 /** Lowers the quality of images */
9 export const lowerImageQuality = (html) => {
10 return html.replace(/\w+:\/\/\S*(w=(\d*))&\w+\S*"/g, (url, w, width) =>
11 // Could lower the width here if needed
12 url.replace(w, 'w=' + Math.floor(Number(width)) + '&q=10'),
13 )
14 }
15
16 /** Capitalize first letter of a string */
17 export const capitalize = (str) =>
18 str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
19