File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11const process = require ( 'node:process' ) ;
2+ const { isIP } = require ( 'net' ) ;
3+ const env = require ( 'good-env' ) ;
24const Sonos = require ( './lib/sonos' ) ;
35const Sensor = require ( './lib/sensor' ) ;
46const { hue } = require ( './lib/config' ) ;
@@ -10,6 +12,14 @@ const {
1012 printNowPlaying,
1113 randomTrack
1214} = require ( './lib/utils' ) ;
15+ const ipOk = str => isIP ( str ) === 4 || isIP ( str ) === 6 ;
16+
17+ // Ensure all the required environemnt variables are present
18+ env . assert (
19+ { 'HUE_BRIDGE_IP' : { type : 'string' , ok : ipOk } } ,
20+ 'HUE_USERNAME' ,
21+ 'HUE_SENSOR_ID' ,
22+ ) ;
1323
1424( async function ( ) {
1525 const trackChoices = await chooseVibe ( ) ;
Original file line number Diff line number Diff line change @@ -79,14 +79,14 @@ function randomTrack (items) {
7979 return items [ Math . floor ( Math . random ( ) * items . length ) ] ;
8080}
8181
82- const camelize = ( str ) => {
82+ function camelize ( str ) {
8383 return str . replace ( / (?: ^ \w | [ A - Z ] | \b \w ) / g, ( word , index ) => {
8484 return index === 0 ? word . toLowerCase ( ) : word . toUpperCase ( ) ;
8585 } )
8686 . replace ( / \s + / g, '' )
8787 . replace ( / ' / g, '' )
8888 . replace ( / ’ / g, '' ) ;
89- } ;
89+ }
9090
9191module . exports = {
9292 buildPlayQueue,
You can’t perform that action at this time.
0 commit comments