MCPcopy Create free account
hub / github.com/ajatkj/scriptable / weatherText

Function weatherText

LSWeather.js:1290–1298  ·  view source on GitHub ↗
(weatherData)

Source from the content-addressed store, hash-verified

1288FUNCTION weatherText
1289------------------------------------------------------------------*/
1290function weatherText(weatherData) {
1291 let desc = weatherData.desc.slice(0, 1).toUpperCase() + weatherData.desc.slice(1, weatherData.desc.length); // capitalize first letter of the data
1292 const text = `${desc} today. It's currently ${weatherData.temp}°; the high will be ${weatherData.high}°.`;
1293 let wrapText = (s, w) => s.replace(
1294 new RegExp(`(?![^\\n]{1,${w}}$)([^\\n]{1,${w}})\\s`, 'g'), '$1\n'
1295 );
1296 const text0 = wrapText(text,50);
1297 return text0;
1298}
1299/*------------------------------------------------------------------
1300FUNCTION calendarText
1301------------------------------------------------------------------*/

Callers

nothing calls this directly

Calls 1

wrapTextFunction · 0.70

Tested by

no test coverage detected