![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.
Server-agnostic named URL builder for node.js
Install the module with: npm install anye
Require module.
var Anye = require( "anye" );
Anye.set( sName, sURL );
sName
is the key to store the URLsURL
is the URL to store. It can have named-parameters beginning by :
, like in /url/:id
.Note: the set
method returns the stored URL, so you can use it directly in your route definition like in express: app.post( Anye.set( "name", "/url/:id" ), routeHandler );
Anye.store()
Anye.set( "name", "/url/:id" ); // will returns "/url/:id"
Anye.get( sName, oParams, bDecode )
sName
is the key of the URL in the store.oParams
is an hash of parameters for the URL, replacing the :variable
in the stored URL. All the additonal parameters will be added to the query string of the URL. Array & Object are supported.bDecode
is a flag to ensure the returned URL is URL-decoded. false
by default.Note: if a parameter of the URL is not given, anyè will throws.
Update: since version 0.3.0
, all the returned URLs are URL-encoded by default.
Anye.retrieve(), Anye.build()
Anye.get( "name", { id: 2 } ); // will returns "/url/2"
Anye.get( "name", { id: "bar^" } ); // will returns "/url/bar%5E"
Anye.get( "name", { id: "bar^" }, true ); // will returns "/url/bar^"
Anye.get( "name", { id: 2, foo: "bar", bar: "baz" } ); // will returns "/url/2?foo=bar&bar=baz"
Anye.get( "name", { id: 2, foo: "bar", bar: { baz: "bar", zab: "baz" } } ); // will returns "/url/2?foo=bar&bar%5Bbaz%5D=bar&bar%5Bzab%5D=baz"
Anye.generate( sURL, oParams, bDecode )
sURL
is the URL to use. It can have named-parameters beginning by :
, like in /url/:id
.oParams
is an hash of parameters for the URL, replacing the :variable
in the stored URL. All the additonal parameters will be added to the query string of the URL. Array & Object are supported.bDecode
is a flag to ensure the returned URL is URL-decoded. false
by default.Note: if a parameter of the URL is not given, anyè will throws.
Anye.generate( "/url/:id", { id: 2 } ); // will returns "/url/2"
Anye.generate( "/url/:id", { id: "bar^" } ); // will returns "/url/bar%5E"
Anye.generate( "/url/:id", { id: "bar^" }, true ); // will returns "/url/bar^"
Anye.generate( "/url/:id", { id: 2, foo: "bar", bar: "baz" } ); // will returns "/url/2?foo=bar&bar=baz"
Anye.generate( "/url/:id", { id: 2, foo: "bar", bar: { baz: "bar", zab: "baz" } } ); // will returns "/url/2?foo=bar&bar%5Bbaz%5D=bar&bar%5Bzab%5D=baz"
Anye.raw( sName )
sName
is the key of the URL in the store.Note: if a parameter of the URL is not given, anyè will throws.
Update: since version 0.3.0
, all the returned URLs are URL-encoded by default.
Anye.url()
Anye.raw( "name"); // will returns "/url/:id"
Anye.clear()
Anye.get( "name", { id: 2 } ); // will returns "/url/2"
Anye.clear();
Anye.get( "name", { id: 2 } ); // throws Error
Anye.all()
Anye.all(); // will returns { "name": "/url/:id" }
Anye.count()
Anye.count(); // will returns 1
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
2.0.0
, Export as cjs
and esm
modules, minimal support in node 10.01.0.0
, Use ES2015 for source, add count
method.0.6.1
, update minimal runtime version.0.6.0
, add all
method.0.5.0
, add raw
method.0.4.0
, add aliases, add generate
method.0.3.0
, returned URLs are encoded by default.0.2.0
, add query-string population with additional parameters.0.1.0
, initial release.Copyright (c) 2014 leny Licensed under the MIT license.
FAQs
Server-agnostic named URL builder for node.js
The npm package anye receives a total of 4 weekly downloads. As such, anye popularity was classified as not popular.
We found that anye demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.