# Re-usable JavaScript code, but not using eval()

**URL:** <https://community.postman.com/t/re-usable-javascript-code-but-not-using-eval/5659>\
**Category:** Help Hub\
**Created:** [May 29, 2019, 4:45pm UTC](https://community.postman.com/t/re-usable-javascript-code-but-not-using-eval/5659 "2019-05-29T16:45:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![toddbarnes](https://avatars.discourse-cdn.com/v4/letter/t/c57346/32.png) [@toddbarnes](https://community.postman.com/u/toddbarnes)\
**Post date:** [May 29, 2019, 4:45pm UTC](https://community.postman.com/t/re-usable-javascript-code-but-not-using-eval/5659/1 "2019-05-29T16:45:26Z")

</div>

Hi,

I have a good amount of re-usable JS code that I have been placing in Global variables and accessed in Test Scripts via “eval()”. Unfortunatley, the “eval()” call does NOT work within Monitors or the CLI Runner.

Please tell me there is some functionality coming that allows us to re-use JS code throughout a Collection? Or, even better, where we can re-use JS code over many Collections?

Thanks,  
Todd

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 14, 2025, 3:56pm UTC](https://community.postman.com/t/re-usable-javascript-code-but-not-using-eval/5659/2 "2025-04-14T15:56:33Z")

</div>

Sorry we didn’t get to this sooner. This isn’t the experience we want for our users.

I believe this is what you’re looking for and was added as part of the major version 11 release last year.

> **[Add internal scripts to the Package Library in Postman | Postman Docs](https://learning.postman.com/docs/tests-and-scripts/write-scripts/packages/package-library/)**
>
> Postman is a collaboration platform for API development. Postman's features simplify each step of building an API and streamline collaboration so you can create better APIs—faster.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 14, 2025, 3:56pm UTC](https://community.postman.com/t/re-usable-javascript-code-but-not-using-eval/5659/3 "2025-04-14T15:56:41Z")

</div>

Closed on April 14, 2025, 3:56pm UTC


