New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ee-soa-transport-rest

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ee-soa-transport-rest - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

5

lib/factory/HTTPRequestFactory.js

@@ -174,3 +174,3 @@ var Class = require('ee-class'),

*/
, _getFormData: function(request, original, cb){
, _getFormData: function(request, original, cb) {
if('getForm' in original){

@@ -268,4 +268,3 @@ original.getForm(function(data){

filters = request.getFilters();
// ...event/5/venue --> venue with filter[event] = {id: {operator: '=', value: 5}}
/** todo: unify the filters creation */
if(base.queriesCollection() && len > 1){

@@ -272,0 +271,0 @@ var related = segments[len-2];

29

lib/maps/MatchingMap.js

@@ -7,14 +7,15 @@ "use strict";

_items: {}
_items: null
, _obj: null
, _pattern: null
, _delimiter: '\.'
, init: function(items, obj, delimiter){
this._delimiter = (arguments.length > 2) ? delimiter : this._delimiter;
, init: function(items, obj) {
this._obj = obj;
this._items = {};
this._pattern = null;
this._prepareItems(items);
}
, _prepareItems: function(items, env){
, _prepareItems: function(items, env) {
var patterns = [],

@@ -26,3 +27,5 @@ len = items.length;

if(item.indexOf('*') > -1){
patterns.push('^'+item.replace('*', '[^'+this._delimiter+']+')+'$');
// all except the star
item = item.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&");
patterns.push(item.replace('*', '.*'));
} else {

@@ -33,10 +36,14 @@ this._items[item] = true;

this._pattern = new RegExp(patterns.join('|'), 'i');
if(patterns.length) {
this._pattern = new RegExp(patterns.join('|'), 'i');
}
}
, get: function(key){
if(this._items.hasOwnProperty(key)){
, get: function(key) {
key = key.toString();
if(this._items[key] === true){
return this._obj;
}
if(this._pattern.test(key)){
if(this._pattern !== null && this._pattern.test(key)){
this._items[key] = true;

@@ -48,3 +55,3 @@ return this._obj;

, has: function(key){
, has: function(key) {
return this.get(key) !== null;

@@ -51,0 +58,0 @@ }

{
"name" : "ee-soa-transport-rest"
, "description" : "Rest specific transport implementation."
, "version" : "0.1.8"
, "version" : "0.1.9"
, "homepage" : "https://github.com/eventEmitter/ee-soa-transport-rest"

@@ -6,0 +6,0 @@ , "author" : "Michael Rüfenacht <ruefe@rcky.ch> (http://rcky.ch/)"

@@ -6,4 +6,5 @@ var assert = require('assert'),

var domainmap = new maps.MatchingMap(['*.domain.*', '*.domain-name.*', 'domain.com'], content),
pathmap = new maps.MatchingMap(['/some/path/*', '/home'], content, '\/');
var domainmap = new maps.MatchingMap(['*.domain.*', '*.domain-name.*', 'domain.com'], content),
pathmap = new maps.MatchingMap(['/some/path/*', '/home'], content),
regexfree = new maps.MatchingMap(['domain.com', 'domain.de'], content);

@@ -14,8 +15,9 @@

it('returns true for simple patterns', function(){
it('returns true for simple patterns', function() {
assert(pathmap.has('/home'));
assert(domainmap.has('domain.com'));
assert(regexfree.has('domain.com'));
});
it('returns true for wildcarded patterns', function(){
it('returns true for wildcarded patterns', function() {
assert(pathmap.has('/some/path/10'));

@@ -25,5 +27,6 @@ assert(domainmap.has('sub.domain.fr'));

it('returns false for missing patterns', function(){
it('returns false for missing patterns', function() {
assert(!pathmap.has('/'));
assert(!domainmap.has('domain.ch'));
assert(!regexfree.has('domain.ch'));
});

@@ -34,11 +37,11 @@

describe('get', function(){
it('returns the object for simple patterns', function(){
it('returns the object for simple patterns', function() {
assert(pathmap.get('/home') === content);
});
it('returns the object for wildcarded patterns', function(){
it('returns the object for wildcarded patterns', function() {
assert(domainmap.get('sub.domain.fr') === content);
});
it('returns null for missing patterns', function(){
it('returns null for missing patterns', function() {
assert(pathmap.get('/') === null);

@@ -45,0 +48,0 @@ });

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