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

@himenon/openapi-parameter-formatter

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@himenon/openapi-parameter-formatter - npm Package Compare versions

Comparing version 0.2.2 to 0.2.6

20

$cjs/Core.js

@@ -28,6 +28,24 @@ "use strict";

const flat_1 = __importDefault(require("flat"));
/**
* @see https://tools.ietf.org/html/rfc6570#section-3.2.2
*/
const generateFromSimple = (key, params) => {
if (Guard.isArray(params.value)) {
return params.value.join(",");
return params.value.filter(Boolean).join(",");
}
if (Guard.isPrimitive(params.value)) {
return `${params.value}`;
}
if (Guard.isObject(params.value)) {
if (params.explode) {
return Object.entries(params.value)
.map(([key, value]) => `${key}=${value || ""}`)
.join(",");
}
else {
return Object.entries(params.value)
.map(([key, value]) => `${key},${value || ""}`)
.join(",");
}
}
return undefined;

@@ -34,0 +52,0 @@ };

import * as Guard from "./Guard";
import flatten from "flat";
/**
* @see https://tools.ietf.org/html/rfc6570#section-3.2.2
*/
export const generateFromSimple = (key, params) => {
if (Guard.isArray(params.value)) {
return params.value.join(",");
return params.value.filter(Boolean).join(",");
}
if (Guard.isPrimitive(params.value)) {
return `${params.value}`;
}
if (Guard.isObject(params.value)) {
if (params.explode) {
return Object.entries(params.value)
.map(([key, value]) => `${key}=${value || ""}`)
.join(",");
}
else {
return Object.entries(params.value)
.map(([key, value]) => `${key},${value || ""}`)
.join(",");
}
}
return undefined;

@@ -8,0 +26,0 @@ };

import { ParameterOfLabel, ParameterOfMatrix, ParameterOfSimple, ParameterOfForm, ParameterOfSpaceDelimited, ParameterOfPipeDelimited, ParameterOfDeepObject } from "./Types";
/**
* @see https://tools.ietf.org/html/rfc6570#section-3.2.2
*/
export declare const generateFromSimple: (key: string | number, params: ParameterOfSimple) => string | undefined;

@@ -3,0 +6,0 @@ export declare const generateFormParamter: (key: string | number, params: ParameterOfForm) => string;

2

$types/Types.d.ts

@@ -21,3 +21,3 @@ export declare type NullType = null;

export interface ParameterOfSimple {
value: ArrayType;
value: PrimitiveType | ArrayType | ObjectType;
style: "simple";

@@ -24,0 +24,0 @@ explode: boolean;

@@ -6,32 +6,56 @@ # Change Log

<a name="0.2.2"></a>
## 0.2.2 (2021-01-14)
<a name="0.2.6"></a>
## 0.2.6 (2022-04-22)
### Bug Fixes
### Chores
* generate nest object keys ([#3](https://github.com/Himenon/openapi-parameter-formatter/issues/3)) ([63abf31](https://github.com/Himenon/openapi-parameter-formatter/commit/63abf31))
- update package manager ([#9](https://github.com/Himenon/openapi-parameter-formatter/issues/9)) ([cabeaee](https://github.com/Himenon/openapi-parameter-formatter/commit/cabeaee))
<a name="0.2.5"></a>
## 0.2.5 (2021-05-11)
### Builds
- **deps:** bump ssri from 6.0.1 to 6.0.2 ([#7](https://github.com/Himenon/openapi-parameter-formatter/issues/7)) ([de8378d](https://github.com/Himenon/openapi-parameter-formatter/commit/de8378d))
<a name="0.2.1"></a>
## 0.2.1 (2021-01-11)
<a name="0.2.4"></a>
## 0.2.4 (2021-04-06)
### Documentation
### Builds
* update ([#2](https://github.com/Himenon/openapi-parameter-formatter/issues/2)) ([2308fb2](https://github.com/Himenon/openapi-parameter-formatter/commit/2308fb2))
- **deps:** bump y18n from 4.0.0 to 4.0.1 ([#6](https://github.com/Himenon/openapi-parameter-formatter/issues/6)) ([4159b79](https://github.com/Himenon/openapi-parameter-formatter/commit/4159b79))
<a name="0.2.3"></a>
## 0.2.3 (2021-02-24)
### Bug Fixes
- Apply the style value according to RFC6570. ([#5](https://github.com/Himenon/openapi-parameter-formatter/issues/5)) ([feda6a6](https://github.com/Himenon/openapi-parameter-formatter/commit/feda6a6)), closes [#4](https://github.com/Himenon/openapi-parameter-formatter/issues/4)
<a name="0.2.2"></a>
## 0.2.2 (2021-01-14)
### Bug Fixes
- generate nest object keys ([#3](https://github.com/Himenon/openapi-parameter-formatter/issues/3)) ([63abf31](https://github.com/Himenon/openapi-parameter-formatter/commit/63abf31))
<a name="0.2.1"></a>
## 0.2.1 (2021-01-11)
### Documentation
- update ([#2](https://github.com/Himenon/openapi-parameter-formatter/issues/2)) ([2308fb2](https://github.com/Himenon/openapi-parameter-formatter/commit/2308fb2))
<a name="0.2.0"></a>
# 0.2.0 (2021-01-11)
### Features
* initialize openapi parameter formatter ([#1](https://github.com/Himenon/openapi-parameter-formatter/issues/1)) ([e7945a0](https://github.com/Himenon/openapi-parameter-formatter/commit/e7945a0))
- initialize openapi parameter formatter ([#1](https://github.com/Himenon/openapi-parameter-formatter/issues/1)) ([e7945a0](https://github.com/Himenon/openapi-parameter-formatter/commit/e7945a0))
{
"name": "@himenon/openapi-parameter-formatter",
"version": "0.2.2",
"version": "0.2.6",
"description": "Serializes OpenAPI parameter objects.",

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

},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"resolutions": {

@@ -63,4 +52,2 @@ "kind-of": "6.0.3",

"devDependencies": {
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"@types/flat": "5.0.1",

@@ -89,2 +76,3 @@ "@types/jest": "26.0.20",

"rimraf": "3.0.2",
"simple-git-hooks": "^2.7.0",
"sort-package-json": "1.48.1",

@@ -96,5 +84,11 @@ "ts-jest": "26.4.4",

},
"engines": {
"pnpm": ">=6"
},
"publishConfig": {
"access": "public"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
}
}
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