Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

anye

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anye - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

17

lib/anye.js

@@ -12,3 +12,3 @@

"use strict";
var QS, _clear, _count, _generate, _get, _set, oAnye, oDataStore, rMatchURLParam,
var QS, _clear, _count, _generate, _get, _raw, _set, oAnye, oDataStore, rMatchURLParam,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

@@ -30,2 +30,13 @@

_raw = function(sName) {
var ref;
return (function() {
if ((ref = oDataStore[sName]) != null) {
return ref;
} else {
throw new Error("Unknown URL '" + sName + "'!");
}
})();
};
_get = function(sName, oParams, bDecode) {

@@ -79,5 +90,7 @@ var sURL;

retrieve: _get,
build: _get
build: _get,
raw: _raw,
url: _raw
};
oAnye.__defineGetter__("length", _count);
{
"name": "anye",
"version": "0.4.2",
"version": "0.5.0",
"description": "Server-agnostic named URL builder for node.js",

@@ -22,2 +22,6 @@ "keywords": [

"url": "http://leny.me"
},
{
"name": "Tibus",
"email": "julien.delnatte@gmail.com"
}

@@ -24,0 +28,0 @@ ],

@@ -106,2 +106,28 @@ # anyè

### Get the raw URL
#### Signature
```javascript
Anye.raw( sName )
```
##### Arguments
- `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.
##### Aliases
`Anye.url()`
#### Example
```javascript
Anye.raw( "name"); // will returns "/url/:id"
```
### Clear the store

@@ -129,2 +155,3 @@

* **2015-09-11:** version `0.5.0`, add `raw` method.
* **2014-10-07:** version `0.4.0`, add aliases, add `generate` method.

@@ -131,0 +158,0 @@ * **2014-10-06:** version `0.3.0`, returned URLs are encoded by default.

@@ -43,2 +43,8 @@ "use strict";

// Raw url
oTest.throws( function() { Anye.raw( "unknown" ); }, "Anye.raw should throws when calling an url that is not in the store." );
oTest.equal( Anye.raw( "simple" ), "/url/", "Anye.raw should return the good url." );
oTest.equal( Anye.raw( "one-param" ), "/url/:id", "Anye.raw should return the good url." );
oTest.equal( Anye.url( "multi-params" ), "/url/:id/:module", "Anye.raw url return the good url." );
// URL Decoding

@@ -45,0 +51,0 @@ oTest.equal( Anye.get( "one-param", { id: "bar^" } ), "/url/bar%5E", "Anye.get should return the good url, with the given params, and URL-encoded by default." );

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc