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.1 to 0.2.2

15

$cjs/Core.js

@@ -21,5 +21,9 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateFromLabel = exports.generateFromMatrix = exports.generateDeepObjectParameter = exports.generatePipeDelimitedParameter = exports.generateSpaceDelimited = exports.generateFormParamter = exports.generateFromSimple = void 0;
const Guard = __importStar(require("./Guard"));
const flat_1 = __importDefault(require("flat"));
const generateFromSimple = (key, params) => {

@@ -93,4 +97,11 @@ if (Guard.isArray(params.value)) {

}
return Object.entries(params.value)
.map(([k, v]) => `${key}[${k}]=${v}`)
const flatObject = flat_1.default(params.value);
return Object.entries(flatObject)
.map(([dotKeyName, primitiveValue]) => {
const nestedKey = dotKeyName
.split(".")
.map(k1 => `[${k1}]`)
.join("");
return `${[key]}${nestedKey}=${primitiveValue}`;
})
.join("&");

@@ -97,0 +108,0 @@ };

import * as Guard from "./Guard";
import flatten from "flat";
export const generateFromSimple = (key, params) => {

@@ -66,4 +67,11 @@ if (Guard.isArray(params.value)) {

}
return Object.entries(params.value)
.map(([k, v]) => `${key}[${k}]=${v}`)
const flatObject = flatten(params.value);
return Object.entries(flatObject)
.map(([dotKeyName, primitiveValue]) => {
const nestedKey = dotKeyName
.split(".")
.map(k1 => `[${k1}]`)
.join("");
return `${[key]}${nestedKey}=${primitiveValue}`;
})
.join("&");

@@ -70,0 +78,0 @@ };

@@ -6,2 +6,14 @@ # Change Log

<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>

@@ -8,0 +20,0 @@ ## 0.2.1 (2021-01-11)

{
"name": "@himenon/openapi-parameter-formatter",
"version": "0.2.1",
"version": "0.2.2",
"description": "Serializes OpenAPI parameter objects.",

@@ -58,5 +58,9 @@ "keywords": [

},
"dependencies": {
"flat": "5.0.2"
},
"devDependencies": {
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"@types/flat": "5.0.1",
"@types/jest": "26.0.20",

@@ -63,0 +67,0 @@ "@types/node": "14.14.20",

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