@himenon/openapi-parameter-formatter
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31718
703
1
30
+ Addedflat@5.0.2
+ Addedflat@5.0.2(transitive)