![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.
A factory for making URL/FileSystem paths with templates and URL query strings.
A factory for making URL/FileSystem paths with templates and URL query strings.
var basePath = PathMaker('/my/path/or/url/');
var subPath = basePath.sub('sub/path');
basePath(); // returns: '/my/path/or/url/'
subPath(); // returns: '/my/path/or/url/sub/path'
See Examples below for extended usage including templates and URL query strings.
Name | Default Value | Description |
---|---|---|
delimiter | '/' | The path delimiter. |
tokenPrefix | ':' | The path token prefix. |
path | '' | The path represented by the PathMaker . |
encodeURIComponent
. No other
part of the path is automatically encoded.import PathMaker from 'pathmaker';
const site = PathMaker('http://www.site.test/');
const api = PathMaker('http://api.site.test/');
const base = PathMaker('http://www.site.test/app-name/');
/** URL makers for any URLs used by this application. */
const AppURL = {
/** Base application URL maker. */
base,
/** Site URL maker, to make URLs outside of base. */
site,
login: base.sub('/login/'),
product: base.sub('/products/:id/'),
products: base.sub('/products/'),
/** API URL makers. */
api: {
/** Base API URL maker. */
base: api,
account: api.sub('account'),
oauth: api.sub('oauth'),
user: api.sub('users/:id'),
users: api.sub('users'),
}
};
export default AppURL;
import AppURL from './AppURL';
console.log(
AppURL.site()
); // http://www.site.test/
console.log(
AppURL.base()
); // http://www.site.test/app-name/
console.log(
AppURL.product({ id: 999 });
); // http://www.site.test/app-name/products/999/
console.log(
AppURL.login({ query: {redirect: '/dashboard'} })
); // http://www.site.test/app-name/login/?redirect=%2Fdashboard
console.log( // Equivalent to above:
AppURL.base('login/', { query: {redirect: '/dashboard'} })
); // http://www.site.test/app-name/login/?redirect=%2Fdashboard
console.log(
AppURL.api.user({ id: 10 })
); // http://api.site.test/users/10
console.log( // Alternatively, pass an array as a path.
AppURL.api.users([10, 'organizations/search'], { query: {q: 'the query'} })
); // http://api.site.test/users/10/organizations/search?q=the%20query
This code is trivial, it works and it's been in use for a while before it was published as an NPM. However, we need tests to protect against regressions! I think jest is already setup here for us.
FAQs
A factory for making URL/FileSystem paths with templates and URL query strings.
The npm package pathmaker receives a total of 0 weekly downloads. As such, pathmaker popularity was classified as not popular.
We found that pathmaker 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.