How to import a package in Lambda function
Options
![Georges Duverger](https://us.v-cdn.net/6037124/user_avatars/1709796.jpg)
Georges Duverger
Trusted Xano Expert ✭
Hey, folks. I need to transform a crontab expression (e.g., “5 4 * * *”) into a timestamp of the next occurence. I couldn't think of a way to do so with existing Xano functions so I tried to do it with a Lambda function. My first, naive attempt was to use https://www.npmjs.com/package/cron-parser but I can't figure out how to import packages. Could you maybe put me toward the right direction, or let me know if there is a better way to solve for that use case?
Comments
-
Right now Xano doesn’t support importing external packages. They provide a few libraries in their Lambda feature and one of them is Lodash. Perhaps you could check out Lodash and see if it could help with your transformation needs?
https://docs.xano.com/working-with-data/lambdas-javascript/libraries-and-functions -
Or actually if you are dealing with date/time data, Moment.js or Luxon may be more suitable
-
You can build a lambda that pastes i ln most of the code from that parser package. It seems to only depend on luxon which xano has support for. Not super simple but probably an hour of work.
-
Thanks a lot for the pointers. I'll take a look.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback