diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7a0fb65c1..ec50c5ea9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,10 +6,15 @@ If you want to contribute but don’t know what to do, take a look at these two _[Use GitHub interface](https://blog.sapegin.me/all/open-source-for-everyone/) for simple documentation changes, otherwise follow the steps below._ +> :warning: IMPORTANT NOTE :warning: +> +> All contributions are expected to be of the highest possible quality! That means the PR is thoroughly tested and documented, and without blindly generated ChatGPT code and documentation! We will not consider nor merge PR-s that do not comply to these rules! + ## Prerequisites - If it’s your first pull request, watch [this amazing course](http://makeapullrequest.com/) by [Kent C. Dodds](https://twitter.com/kentcdodds). - Fork the repository and clone your fork. +- Checkout to the `develop` branch. - Install dependencies: `npm install`. ## Development workflow @@ -34,8 +39,9 @@ Or run tests in watch mode: npm test --watch ``` -By default the tests are executed in your local Devnet. If you want to use a specific -RPC node, you have to set some global variables before executing the tests: +By default the tests are executed in your local Devnet and everything should run automatically. + +If you want to use a specific RPC node, you have to set some global variables before executing the tests: ```bash export TEST_RPC_URL=http://192.168.1.44:9545/rpc/v0.5 # example of a Pathfinder node located in your local network diff --git a/src/utils/url.ts b/src/utils/url.ts index 9f1bb47ce..b1318cf85 100644 --- a/src/utils/url.ts +++ b/src/utils/url.ts @@ -16,6 +16,14 @@ const nonLocalhostDomainRE = /^[^\s.]+\.\S{2,}$/; /** * Loosely validate a URL `string`. + * + * @param {string} s - The URL to check for + * @return {boolean} `true` if url is valid, `false` otherwise + * @example + * ```typescript + * const s = "https://starknetjs.com/docs"; + * const result = isUrl(s); + * // result == true */ export function isUrl(s?: string): boolean { if (!s) { @@ -53,6 +61,14 @@ export function isUrl(s?: string): boolean { * @param {string} defaultPath - The default path to use if no URL or path is provided. * @param {string} [urlOrPath] - The optional URL or path to append to the base URL. * @return {string} The built URL. + * @example + * ```typescript + * const baseUrl = "https://starknetjs.com"; + * const defaultPath = "/"; + * const urlOrPath = "/docs"; + * const result = buildUrl(baseUrl, defaultPath, urlOrPath); + * + * result = "https://starknetjs.com/docs" */ export function buildUrl(baseUrl: string, defaultPath: string, urlOrPath?: string) { return isUrl(urlOrPath) ? urlOrPath! : urljoin(baseUrl, urlOrPath ?? defaultPath);