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 2.0.0 to 2.0.1

types/anye.d.ts

2

lib/cjs/anye.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.count=exports.all=exports.url=exports.raw=exports.build=exports.retrieve=exports.get=exports.store=exports.set=exports.generate=exports.clear=void 0;var _qs=_interopRequireDefault(require("qs"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var datastore={};var matchURLParam=/:[a-z0-9_]+/gi;var clear=function clear(){datastore={};};exports.clear=clear;var set=function set(name,url){datastore[name]=url;return datastore[name];};exports.store=exports.set=set;var raw=function raw(name){if(!datastore[name]){throw new Error("Unknown URL '".concat(name,"'!"));}return datastore[name];};exports.url=exports.raw=raw;var generate=function generate(url){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var matches=url.match(matchURLParam)||[],additionalParams={},queryString,result;result=matches.reduce(function(acc,match){var value;if(!(value=params[match.slice(1)])){throw new Error("Undefined param '".concat(match,"'!"));}return acc.replace(match,encodeURIComponent(value));},url);Object.keys(params).forEach(function(param){if(!matches.includes(":".concat(param))){additionalParams[param]=params[param];}});if(queryString=_qs.default.stringify(additionalParams)){result+="?".concat(queryString);}return decode?decodeURIComponent(result):result;};exports.generate=generate;var get=function get(name,params){var decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var url;if(!(url=datastore[name])){throw new Error("Unknown URL '".concat(name,"'!"));}return generate(url,params,decode);};exports.build=exports.retrieve=exports.get=get;var count=function count(){return Object.keys(datastore).length;};exports.count=count;var all=function all(){return datastore;};exports.all=all;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.count=exports.all=exports.url=exports.raw=exports.build=exports.retrieve=exports.get=exports.store=exports.set=exports.generate=exports.clear=void 0;var _qs=_interopRequireDefault(require("qs"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj};}var datastore={};var matchURLParam=/:[a-z0-9_]+/gi;var clear=function clear(){datastore={};};exports.clear=clear;var set=function set(name,url){datastore[name]=url;return datastore[name];};exports.store=exports.set=set;var raw=function raw(name){if(!datastore[name]){throw new Error("Unknown URL '".concat(name,"'!"));}return datastore[name];};exports.url=exports.raw=raw;var generate=function generate(url){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var matches=url.match(matchURLParam)||[],additionalParams={},queryString,result;result=matches.reduce(function(acc,match){var value;if(!(value=params[match.slice(1)])){throw new Error("Undefined param '".concat(match,"'!"));}return acc.replace(match,encodeURIComponent(value));},url);Object.keys(params).forEach(function(param){if(!matches.includes(":".concat(param))){additionalParams[param]=params[param];}});if(queryString=_qs["default"].stringify(additionalParams)){result+="?".concat(queryString);}return decode?decodeURIComponent(result):result;};exports.generate=generate;var get=function get(name,params){var decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var url;if(!(url=datastore[name])){throw new Error("Unknown URL '".concat(name,"'!"));}return generate(url,params,decode);};exports.build=exports.retrieve=exports.get=get;var count=function count(){return Object.keys(datastore).length;};exports.count=count;var all=function all(){return datastore;};exports.all=all;

@@ -1,1 +0,1 @@

import QS from"qs";let datastore={};const matchURLParam=/:[a-z0-9_]+/gi;const clear=()=>{datastore={};};const set=(name,url)=>{datastore[name]=url;return datastore[name];};const raw=name=>{if(!datastore[name]){throw new Error("Unknown URL '".concat(name,"'!"));}return datastore[name];};const generate=function generate(url){let params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;let matches=url.match(matchURLParam)||[],additionalParams={},queryString,result;result=matches.reduce((acc,match)=>{let value;if(!(value=params[match.slice(1)])){throw new Error("Undefined param '".concat(match,"'!"));}return acc.replace(match,encodeURIComponent(value));},url);Object.keys(params).forEach(param=>{if(!matches.includes(":".concat(param))){additionalParams[param]=params[param];}});if(queryString=QS.stringify(additionalParams)){result+="?".concat(queryString);}return decode?decodeURIComponent(result):result;};const get=function get(name,params){let decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;let url;if(!(url=datastore[name])){throw new Error("Unknown URL '".concat(name,"'!"));}return generate(url,params,decode);};const count=()=>Object.keys(datastore).length;const all=()=>datastore;export{clear,generate,set,set as store,get,get as retrieve,get as build,raw,raw as url,all,count};
import QS from"qs";var datastore={};var matchURLParam=/:[a-z0-9_]+/gi;var clear=()=>{datastore={};};var set=(name,url)=>{datastore[name]=url;return datastore[name];};var raw=name=>{if(!datastore[name]){throw new Error("Unknown URL '".concat(name,"'!"));}return datastore[name];};var generate=function generate(url){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var matches=url.match(matchURLParam)||[],additionalParams={},queryString,result;result=matches.reduce((acc,match)=>{var value;if(!(value=params[match.slice(1)])){throw new Error("Undefined param '".concat(match,"'!"));}return acc.replace(match,encodeURIComponent(value));},url);Object.keys(params).forEach(param=>{if(!matches.includes(":".concat(param))){additionalParams[param]=params[param];}});if(queryString=QS.stringify(additionalParams)){result+="?".concat(queryString);}return decode?decodeURIComponent(result):result;};var get=function get(name,params){var decode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var url;if(!(url=datastore[name])){throw new Error("Unknown URL '".concat(name,"'!"));}return generate(url,params,decode);};var count=()=>Object.keys(datastore).length;var all=()=>datastore;export{clear,generate,set,set as store,get,get as retrieve,get as build,raw,raw as url,all,count};
{
"name": "anye",
"version": "2.0.0",
"version": "2.0.1",
"description": "Server-agnostic named URL builder for node.js",

@@ -43,2 +43,3 @@ "keywords": [

"module": "lib/esm/anye.js",
"types": "types/anye.d.ts",
"scripts": {

@@ -54,3 +55,4 @@ "build:cjs": "npx babel src --env-name cjs --out-dir lib/cjs",

"lib",
"src"
"src",
"types"
],

@@ -79,9 +81,9 @@ "engines": {

"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint": "^7.2.0",
"eslint-plugin-prettier": "^3.0.1",
"husky": "^1.3.1",
"lint-staged": "^8.1.4",
"husky": "^4.2.1",
"lint-staged": "^10.0.7",
"nodeunit": "^0.11.3",
"prettier": "^1.16.4"
"prettier": "^2.0.4"
}
}
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