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

switch-path

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

switch-path - npm Package Compare versions

Comparing version 1.1.8 to 1.2.0

.github/ISSUE_TEMPLATE.md

246

dist/switch-path.js

@@ -1,115 +0,88 @@

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.switchPath = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = require('./util');
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";
var util_1 = require("./util");
function switchPathInputGuard(path, routes) {
if (!(0, _util.isPattern)(path)) {
throw new Error('First parameter to switchPath must be a route path.');
}
if (!(0, _util.isRouteDefinition)(routes)) {
throw new Error('Second parameter to switchPath must be an object ' + 'containing route patterns.');
}
if (!util_1.isPattern(path)) {
throw new Error("First parameter to switchPath must be a route path.");
}
if (!util_1.isRouteDefinition(routes)) {
throw new Error("Second parameter to switchPath must be an object " +
"containing route patterns.");
}
}
function validatePath(sourcePath, matchedPath) {
var sourceParts = (0, _util.splitPath)(sourcePath);
var matchedParts = (0, _util.splitPath)(matchedPath);
for (var i = 0; i < matchedParts.length; ++i) {
if (matchedParts[i] !== sourceParts[i]) {
return null;
var sourceParts = util_1.splitPath(sourcePath);
var matchedParts = util_1.splitPath(matchedPath);
for (var i = 0; i < matchedParts.length; ++i) {
if (matchedParts[i] !== sourceParts[i]) {
return null;
}
}
}
return '/' + (0, _util.extractPartial)(sourcePath, matchedPath);
return "/" + util_1.extractPartial(sourcePath, matchedPath);
}
function betterMatch(candidate, reference) {
if (!(0, _util.isNotNull)(candidate)) {
return false;
}
if (!(0, _util.isNotNull)(reference)) {
return true;
}
if (!validatePath(candidate, reference)) {
return false;
}
return candidate.length >= reference.length;
if (!util_1.isNotNull(candidate)) {
return false;
}
if (!util_1.isNotNull(reference)) {
return true;
}
if (!validatePath(candidate, reference)) {
return false;
}
return candidate.length >= reference.length;
}
function matchesWithParams(sourcePath, pattern) {
var sourceParts = (0, _util.splitPath)(sourcePath);
var patternParts = (0, _util.splitPath)(pattern);
var params = patternParts.map(function (part, i) {
return (0, _util.isParam)(part) ? sourceParts[i] : null;
}).filter(_util.isNotNull);
var matched = patternParts.every(function (part, i) {
return (0, _util.isParam)(part) || part === sourceParts[i];
});
return matched ? params : [];
var sourceParts = util_1.splitPath(sourcePath);
var patternParts = util_1.splitPath(pattern);
var params = patternParts
.map(function (part, i) { return util_1.isParam(part) ? sourceParts[i] : null; })
.filter(util_1.isNotNull);
var matched = patternParts
.every(function (part, i) { return util_1.isParam(part) || part === sourceParts[i]; });
return matched ? params : [];
}
function getParamFnValue(paramFn, params) {
var _paramFn = (0, _util.isRouteDefinition)(paramFn) ? paramFn['/'] : paramFn;
return typeof _paramFn === 'function' ? _paramFn.apply(undefined, _toConsumableArray(params)) : _paramFn;
var _paramFn = util_1.isRouteDefinition(paramFn) ? paramFn["/"] : paramFn;
return typeof _paramFn === "function" ? _paramFn.apply(void 0, params) : _paramFn;
}
function validate(_ref) {
var sourcePath = _ref.sourcePath;
var matchedPath = _ref.matchedPath;
var matchedValue = _ref.matchedValue;
var routes = _ref.routes;
var path = matchedPath ? validatePath(sourcePath, matchedPath) : null;
var value = matchedValue;
if (!path) {
path = routes['*'] ? sourcePath : null;
value = path ? routes['*'] : null;
}
return { path: path, value: value };
function validate(_a) {
var sourcePath = _a.sourcePath, matchedPath = _a.matchedPath, matchedValue = _a.matchedValue, routes = _a.routes;
var path = matchedPath ? validatePath(sourcePath, matchedPath) : null;
var value = matchedValue;
if (!path) {
path = routes["*"] ? sourcePath : null;
value = path ? routes["*"] : null;
}
return { path: path, value: value };
}
function switchPath(sourcePath, routes) {
switchPathInputGuard(sourcePath, routes);
var matchedPath = null;
var matchedValue = null;
(0, _util.traverseRoutes)(routes, function matchPattern(pattern) {
if (sourcePath.search(pattern) === 0 && betterMatch(pattern, matchedPath)) {
matchedPath = pattern;
matchedValue = routes[pattern];
}
var params = matchesWithParams(sourcePath, pattern).filter(Boolean);
if (params.length > 0 && betterMatch(sourcePath, matchedPath)) {
matchedPath = (0, _util.extractPartial)(sourcePath, pattern);
matchedValue = getParamFnValue(routes[pattern], params);
}
if ((0, _util.isRouteDefinition)(routes[pattern]) && params.length === 0) {
if (sourcePath !== '/') {
var child = switchPath((0, _util.unprefixed)(sourcePath, pattern) || '/', routes[pattern]);
var nestedPath = pattern + child.path;
if (child.path !== null && betterMatch(nestedPath, matchedPath)) {
matchedPath = nestedPath;
matchedValue = child.value;
switchPathInputGuard(sourcePath, routes);
var matchedPath = null;
var matchedValue = null;
util_1.traverseRoutes(routes, function matchPattern(pattern) {
if (sourcePath.search(pattern) === 0 && betterMatch(pattern, matchedPath)) {
matchedPath = pattern;
matchedValue = routes[pattern];
}
}
}
});
return validate({ sourcePath: sourcePath, matchedPath: matchedPath, matchedValue: matchedValue, routes: routes });
var params = matchesWithParams(sourcePath, pattern).filter(Boolean);
if (params.length > 0 && betterMatch(sourcePath, matchedPath)) {
matchedPath = util_1.extractPartial(sourcePath, pattern);
matchedValue = getParamFnValue(routes[pattern], params);
}
if (util_1.isRouteDefinition(routes[pattern]) && params.length === 0) {
if (sourcePath !== "/") {
var child = switchPath(util_1.unprefixed(sourcePath, pattern) || "/", routes[pattern]);
var nestedPath = pattern + child.path;
if (child.path !== null &&
betterMatch(nestedPath, matchedPath)) {
matchedPath = nestedPath;
matchedValue = child.value;
}
}
}
});
return validate({ sourcePath: sourcePath, matchedPath: matchedPath, matchedValue: matchedValue, routes: routes });
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = switchPath;

@@ -119,65 +92,48 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isPattern = isPattern;
exports.isRouteDefinition = isRouteDefinition;
exports.traverseRoutes = traverseRoutes;
exports.isNotNull = isNotNull;
exports.splitPath = splitPath;
exports.isParam = isParam;
exports.extractPartial = extractPartial;
exports.unprefixed = unprefixed;
function isPattern(candidate) {
return typeof candidate === "string" && (candidate.charAt(0) === "/" || candidate === "*");
return candidate.charAt(0) === "/" || candidate === "*";
}
exports.isPattern = isPattern;
function isRouteDefinition(candidate) {
return !candidate || typeof candidate !== "object" ? false : isPattern(Object.keys(candidate)[0]);
return !candidate || typeof candidate !== "object" ?
false : isPattern(Object.keys(candidate)[0]);
}
exports.isRouteDefinition = isRouteDefinition;
function traverseRoutes(routes, callback) {
var keys = Object.keys(routes);
for (var i = 0; i < keys.length; ++i) {
var pattern = keys[i];
if (pattern === "*") {
continue;
var keys = Object.keys(routes);
for (var i = 0; i < keys.length; ++i) {
var pattern = keys[i];
if (pattern === "*")
continue;
callback(pattern);
}
callback(pattern);
}
}
exports.traverseRoutes = traverseRoutes;
function isNotNull(candidate) {
return candidate !== null;
return candidate !== null;
}
exports.isNotNull = isNotNull;
function splitPath(path) {
return path.split("/").filter(function (s) {
return !!s;
});
return path.split("/").filter(function (s) { return !!s; });
}
exports.splitPath = splitPath;
function isParam(candidate) {
return candidate.match(/:\w+/) !== null;
return candidate.match(/:\w+/) !== null;
}
exports.isParam = isParam;
function extractPartial(sourcePath, pattern) {
var patternParts = splitPath(pattern);
var sourceParts = splitPath(sourcePath);
var matchedParts = [];
for (var i = 0; i < patternParts.length; ++i) {
matchedParts.push(sourceParts[i]);
}
return matchedParts.filter(isNotNull).join("/");
var patternParts = splitPath(pattern);
var sourceParts = splitPath(sourcePath);
var matchedParts = [];
for (var i = 0; i < patternParts.length; ++i) {
matchedParts.push(sourceParts[i]);
}
return matchedParts.filter(isNotNull).join("/");
}
exports.extractPartial = extractPartial;
function unprefixed(fullString, prefix) {
return fullString.split(prefix)[1];
return fullString.split(prefix)[1];
}
exports.unprefixed = unprefixed;
},{}]},{},[1])(1)
});
},{}]},{},[1]);

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

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.switchPath=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _util=require("./util");function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i]}return arr2}else{return Array.from(arr)}}function switchPathInputGuard(path,routes){if(!(0,_util.isPattern)(path)){throw new Error("First parameter to switchPath must be a route path.")}if(!(0,_util.isRouteDefinition)(routes)){throw new Error("Second parameter to switchPath must be an object "+"containing route patterns.")}}function validatePath(sourcePath,matchedPath){var sourceParts=(0,_util.splitPath)(sourcePath);var matchedParts=(0,_util.splitPath)(matchedPath);for(var i=0;i<matchedParts.length;++i){if(matchedParts[i]!==sourceParts[i]){return null}}return"/"+(0,_util.extractPartial)(sourcePath,matchedPath)}function betterMatch(candidate,reference){if(!(0,_util.isNotNull)(candidate)){return false}if(!(0,_util.isNotNull)(reference)){return true}if(!validatePath(candidate,reference)){return false}return candidate.length>=reference.length}function matchesWithParams(sourcePath,pattern){var sourceParts=(0,_util.splitPath)(sourcePath);var patternParts=(0,_util.splitPath)(pattern);var params=patternParts.map(function(part,i){return(0,_util.isParam)(part)?sourceParts[i]:null}).filter(_util.isNotNull);var matched=patternParts.every(function(part,i){return(0,_util.isParam)(part)||part===sourceParts[i]});return matched?params:[]}function getParamFnValue(paramFn,params){var _paramFn=(0,_util.isRouteDefinition)(paramFn)?paramFn["/"]:paramFn;return typeof _paramFn==="function"?_paramFn.apply(undefined,_toConsumableArray(params)):_paramFn}function validate(_ref){var sourcePath=_ref.sourcePath;var matchedPath=_ref.matchedPath;var matchedValue=_ref.matchedValue;var routes=_ref.routes;var path=matchedPath?validatePath(sourcePath,matchedPath):null;var value=matchedValue;if(!path){path=routes["*"]?sourcePath:null;value=path?routes["*"]:null}return{path:path,value:value}}function switchPath(sourcePath,routes){switchPathInputGuard(sourcePath,routes);var matchedPath=null;var matchedValue=null;(0,_util.traverseRoutes)(routes,function matchPattern(pattern){if(sourcePath.search(pattern)===0&&betterMatch(pattern,matchedPath)){matchedPath=pattern;matchedValue=routes[pattern]}var params=matchesWithParams(sourcePath,pattern).filter(Boolean);if(params.length>0&&betterMatch(sourcePath,matchedPath)){matchedPath=(0,_util.extractPartial)(sourcePath,pattern);matchedValue=getParamFnValue(routes[pattern],params)}if((0,_util.isRouteDefinition)(routes[pattern])&&params.length===0){if(sourcePath!=="/"){var child=switchPath((0,_util.unprefixed)(sourcePath,pattern)||"/",routes[pattern]);var nestedPath=pattern+child.path;if(child.path!==null&&betterMatch(nestedPath,matchedPath)){matchedPath=nestedPath;matchedValue=child.value}}}});return validate({sourcePath:sourcePath,matchedPath:matchedPath,matchedValue:matchedValue,routes:routes})}exports.default=switchPath},{"./util":2}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isPattern=isPattern;exports.isRouteDefinition=isRouteDefinition;exports.traverseRoutes=traverseRoutes;exports.isNotNull=isNotNull;exports.splitPath=splitPath;exports.isParam=isParam;exports.extractPartial=extractPartial;exports.unprefixed=unprefixed;function isPattern(candidate){return typeof candidate==="string"&&(candidate.charAt(0)==="/"||candidate==="*")}function isRouteDefinition(candidate){return!candidate||typeof candidate!=="object"?false:isPattern(Object.keys(candidate)[0])}function traverseRoutes(routes,callback){var keys=Object.keys(routes);for(var i=0;i<keys.length;++i){var pattern=keys[i];if(pattern==="*"){continue}callback(pattern)}}function isNotNull(candidate){return candidate!==null}function splitPath(path){return path.split("/").filter(function(s){return!!s})}function isParam(candidate){return candidate.match(/:\w+/)!==null}function extractPartial(sourcePath,pattern){var patternParts=splitPath(pattern);var sourceParts=splitPath(sourcePath);var matchedParts=[];for(var i=0;i<patternParts.length;++i){matchedParts.push(sourceParts[i])}return matchedParts.filter(isNotNull).join("/")}function unprefixed(fullString,prefix){return fullString.split(prefix)[1]}},{}]},{},[1])(1)});
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){"use strict";var util_1=require("./util");function switchPathInputGuard(path,routes){if(!util_1.isPattern(path)){throw new Error("First parameter to switchPath must be a route path.")}if(!util_1.isRouteDefinition(routes)){throw new Error("Second parameter to switchPath must be an object "+"containing route patterns.")}}function validatePath(sourcePath,matchedPath){var sourceParts=util_1.splitPath(sourcePath);var matchedParts=util_1.splitPath(matchedPath);for(var i=0;i<matchedParts.length;++i){if(matchedParts[i]!==sourceParts[i]){return null}}return"/"+util_1.extractPartial(sourcePath,matchedPath)}function betterMatch(candidate,reference){if(!util_1.isNotNull(candidate)){return false}if(!util_1.isNotNull(reference)){return true}if(!validatePath(candidate,reference)){return false}return candidate.length>=reference.length}function matchesWithParams(sourcePath,pattern){var sourceParts=util_1.splitPath(sourcePath);var patternParts=util_1.splitPath(pattern);var params=patternParts.map(function(part,i){return util_1.isParam(part)?sourceParts[i]:null}).filter(util_1.isNotNull);var matched=patternParts.every(function(part,i){return util_1.isParam(part)||part===sourceParts[i]});return matched?params:[]}function getParamFnValue(paramFn,params){var _paramFn=util_1.isRouteDefinition(paramFn)?paramFn["/"]:paramFn;return typeof _paramFn==="function"?_paramFn.apply(void 0,params):_paramFn}function validate(_a){var sourcePath=_a.sourcePath,matchedPath=_a.matchedPath,matchedValue=_a.matchedValue,routes=_a.routes;var path=matchedPath?validatePath(sourcePath,matchedPath):null;var value=matchedValue;if(!path){path=routes["*"]?sourcePath:null;value=path?routes["*"]:null}return{path:path,value:value}}function switchPath(sourcePath,routes){switchPathInputGuard(sourcePath,routes);var matchedPath=null;var matchedValue=null;util_1.traverseRoutes(routes,function matchPattern(pattern){if(sourcePath.search(pattern)===0&&betterMatch(pattern,matchedPath)){matchedPath=pattern;matchedValue=routes[pattern]}var params=matchesWithParams(sourcePath,pattern).filter(Boolean);if(params.length>0&&betterMatch(sourcePath,matchedPath)){matchedPath=util_1.extractPartial(sourcePath,pattern);matchedValue=getParamFnValue(routes[pattern],params)}if(util_1.isRouteDefinition(routes[pattern])&&params.length===0){if(sourcePath!=="/"){var child=switchPath(util_1.unprefixed(sourcePath,pattern)||"/",routes[pattern]);var nestedPath=pattern+child.path;if(child.path!==null&&betterMatch(nestedPath,matchedPath)){matchedPath=nestedPath;matchedValue=child.value}}}});return validate({sourcePath:sourcePath,matchedPath:matchedPath,matchedValue:matchedValue,routes:routes})}Object.defineProperty(exports,"__esModule",{value:true});exports.default=switchPath},{"./util":2}],2:[function(require,module,exports){"use strict";function isPattern(candidate){return candidate.charAt(0)==="/"||candidate==="*"}exports.isPattern=isPattern;function isRouteDefinition(candidate){return!candidate||typeof candidate!=="object"?false:isPattern(Object.keys(candidate)[0])}exports.isRouteDefinition=isRouteDefinition;function traverseRoutes(routes,callback){var keys=Object.keys(routes);for(var i=0;i<keys.length;++i){var pattern=keys[i];if(pattern==="*")continue;callback(pattern)}}exports.traverseRoutes=traverseRoutes;function isNotNull(candidate){return candidate!==null}exports.isNotNull=isNotNull;function splitPath(path){return path.split("/").filter(function(s){return!!s})}exports.splitPath=splitPath;function isParam(candidate){return candidate.match(/:\w+/)!==null}exports.isParam=isParam;function extractPartial(sourcePath,pattern){var patternParts=splitPath(pattern);var sourceParts=splitPath(sourcePath);var matchedParts=[];for(var i=0;i<patternParts.length;++i){matchedParts.push(sourceParts[i])}return matchedParts.filter(isNotNull).join("/")}exports.extractPartial=extractPartial;function unprefixed(fullString,prefix){return fullString.split(prefix)[1]}exports.unprefixed=unprefixed},{}]},{},[1]);
{
"name": "switch-path",
"version": "1.1.8",
"version": "1.2.0",
"description": "switch case for URLs, a small tool for routing in JavaScript",
"main": "lib/index.js",
"jsnext:main": "lib/es2015/index.js",
"module": "lib/es2015/index.js",
"typings": "lib/es2015/index.d.ts",
"main": "lib/commonjs/index.js",
"author": "Andre Staltz",

@@ -13,32 +16,38 @@ "license": "MIT",

"devDependencies": {
"babel-cli": "^6.6.5",
"babel-core": "^6.7.2",
"babel-preset-es2015": "^6.6.0",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"chai": "^3.5.0",
"eslint": "^1.10.3",
"eslint-config-cycle": "^3.2.0",
"eslint-plugin-cycle": "^1.0.2",
"eslint-plugin-no-class": "^0.1.0",
"markdox": "^0.1.10",
"mocha": "^2.4.5",
"uglify-js": "^2.6.2"
"@motorcycle/tslint": "^1.2.0",
"@types/mocha": "^2.2.33",
"@types/node": "0.0.2",
"browserify": "^13.1.1",
"commitizen": "^2.8.6",
"conventional-changelog-cli": "^1.2.0",
"cz-conventional-changelog": "^1.2.0",
"ghooks": "^1.3.2",
"mocha": "^2.5.3",
"ts-node": "^1.7.2",
"tslint": "^4.0.2",
"typescript": "^2.1.4",
"uglify-js": "^2.7.5",
"validate-commit-msg": "^2.8.2"
},
"scripts": {
"eslint": "eslint src/",
"mocha": "mocha --compilers js:babel-core/register test",
"test": "npm run eslint && npm run mocha",
"test-ci": "npm run eslint && npm run mocha",
"browserify": "browserify src/index.js -t babelify --standalone switchPath --outfile dist/switch-path.js",
"uglify": "uglifyjs dist/switch-path.js -o dist/switch-path.min.js",
"precompile-lib": "rm -rf lib/ && mkdir -p lib",
"compile-lib": "babel -d lib/ src/",
"dist": "npm run browserify && npm run uglify",
"prepublish": "npm run compile-lib",
"release": "npm run release-patch",
"release-patch": "git checkout master && npm run dist; git commit -a -m 'Build dist/'; npm version patch && git push origin master --tags && npm publish --access=public",
"release-minor": "git checkout master && npm run dist; git commit -a -m 'Build dist/'; npm version minor && git push origin master --tags && npm publish --access=public",
"release-major": "git checkout master && npm run dist; git commit -a -m 'Build dist/'; npm version major && git push origin master --tags && npm publish --access=public"
"test:lint": "tslint src/**/*.ts src/*.ts",
"test:unit": "TS_NODE_PROJECT=test/tsconfig.json mocha -r ts-node/register test/*.ts",
"test": "npm run test:lint && npm run test:unit",
"commit": "git-cz",
"changelog": "conventional-changelog --infile CHANGELOG.md --same-file --release-count 0 --preset angular",
"postchangelog": "git add CHANGELOG.md && git commit -m 'docs(CHANGELOG): append to changelog'",
"build:es2015": "tsc -P tsconfig.json",
"build:commonjs": "tsc -P tsconfig.commonjs.json",
"build:dist": "browserify lib/commonjs/index.js -o dist/switch-path.js && uglifyjs dist/switch-path.js -o dist/switch-path.min.js",
"build": "npm run build:es2015 && npm run build:commonjs && npm run build:dist",
"preversion": "npm run build",
"postversion": "npm run changelog && git push origin master --tags && npm publish",
"release:minor": "npm version minor -m 'chore(package): v%s'",
"release:major": "npm version major -m 'chore(package): v%s'"
},
"config": {
"ghooks": {
"commit-msg": "node ./node_modules/.bin/validate-commit-msg"
}
}
}

Sorry, the diff of this file is not supported yet

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