![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
resource-path
Advanced tools
Tiny module to generate resource paths for APIs, with zero dependencies
This module implements Angular's resource URL definition, so that you can easily interact with an API.
Example:
import resource from 'resource-path';
const input = '/path/to/resource/:id';
const params = {
id: 123
};
resource(input, params);
// Returns: /path/to/resource/123
const input = '/path/to/resource/:id/something/:param2';
const params = {
id: 123
};
resource(input, params);
// Returns: /path/to/resource/123
Install:
npm install --save resource-path
// or if you prefer yarn
yarn add resource-path
Usage
import resource from 'resource-path';
resource(path, [params]);
path
{string}
Is the path to the resource. Either a full URL or a relative path. It can contain identifiers in the form of :identifier
in any part of the path.params
{Object}
An object with key/value pairs, where the keys are identifiers in the path, and the value is what will be replaced in it.The resource
method will return the path, substituting the params whenever if finds an indentifier. As soon as it finds an identifier without a specified parameter it stops.This way you can define full API paths that are reusable.
Tests are located in the tests
folder, and are written with ava
.
Feel free to send any PR with new features, more test cases...
This project is licensed under the MIT License.
FAQs
Tiny module to generate resource paths for APIs
The npm package resource-path receives a total of 2 weekly downloads. As such, resource-path popularity was classified as not popular.
We found that resource-path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.