How to use flat

Comprehensive flat code examples:

How to use flat.flatten:

109
110
111
112
113
114
115
116
117
118
          if(!sensors.includes(args.sensor_type)){
              throw new Error('Wrong Input')
          }

	const result = await getGraph(args.sensor_type);
          // const data = flatten(result)
          // await client.hset('getgraph:'+args.sensor_type,data)
          // await client.expire('getgraph:'+args.sensor_type,120)
	return result;
} catch (error) {

How to use flat.unflatten:

102
103
104
105
106
107
108
109
110
111
    throw new Error('Not Authenticated' );
}
try {
          // const client = redis.getClient();
          // let result = await client.hgetall('getgraph:'+args.sensor_type)
          // if(!_.isEmpty(result)) return unflatten(result)
          const sensors=['humidity','temperature','carbondioxide','carbonmonoxide','methane']
          if(!sensors.includes(args.sensor_type)){
              throw new Error('Wrong Input')
          }