Skip to content

Commit

Permalink
fixed publish config
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-yasenytsky committed Feb 2, 2023
1 parent abcd342 commit 6991922
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 44 deletions.
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.idea
.nyc_output
node_modules
coverage
*.log
package-lock.json
test
register.js
.prettierignore
.nycrc.json
.mocharc.json
.eslintrc.json
.editorconfig
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.idea/*
.nyc_output/*
.npmrc
.idea
.nyc_output
build
node_modules
src/**.js
coverage
*.log
package-lock.json
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.idea
.nyc_output
node_modules
coverage
*.log
package-lock.json
test
src
register.js
.prettierignore
.nycrc.json
.mocharc.json
.eslintrc.json
.editorconfig
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Javascript functions for transform or mutate object
## Installation

``` sh
npm install js-object-utils
npm install @idapgroup/js-object-utils
```
or

```sh
yarn add js-object-utils
yarn add @idapgroup/js-object-utils
```

## Usage
Expand All @@ -20,7 +20,7 @@ yarn add js-object-utils
Serialize object to FormData instance.

```js
import { createFormData } from 'js-object-utils';
import { createFormData } from '@idapgroup/js-object-utils';

const object = {
/**
Expand Down Expand Up @@ -73,7 +73,7 @@ const formData = createFormData(
Serialize object to object with key and primitive value.

```js
import { createURLParams } from 'js-object-utils';
import { createURLParams } from '@idapgroup/js-object-utils';

const object = {
/**
Expand Down
21 changes: 14 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"name": "@idapgroup/js-object-utils",
"version": "0.1.0",
"version": "0.1.5",
"description": "Javascript functions for transform or mutate object",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
"module": "build/module/index.js",
"repository": {
"type": "git",
"url": "https://github.com/idapgroup/js-object-utils"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/idapgroup"
"url": "https://github.com/idapgroup/js-object-utils.git"
},
"license": "MIT",
"scripts": {
"build": "run-p build:*",
"build:main": "tsc -p tsconfig.json",
"build:module": "tsc -p tsconfig.module.json",
"fix": "run-s fix:*",
"fix:prettier": "prettier \"src/**/*.ts\" --write",
"fix:lint": "eslint src --ext .ts --fix",
Expand Down Expand Up @@ -59,5 +55,16 @@
"exclude": [
"**/*.spec.js"
]
}
},
"bugs": {
"url": "https://github.com/idapgroup/js-object-utils/issues"
},
"homepage": "https://github.com/idapgroup/js-object-utils#readme",
"keywords": [
"formData",
"object to formData",
"object to url params",
"url params"
],
"author": "idapgroup.com"
}
3 changes: 0 additions & 3 deletions src/index.d.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export * from './lib/create-url-params';
export * from './lib/create-form-data';
export { createURLParams } from './lib/create-url-params';
export { createFormData } from './lib/create-form-data';
export * from './types/create-url-params';
export * from './types/create-form-data';
16 changes: 11 additions & 5 deletions src/lib/create-form-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { CreateFormDataConfig, FormValue } from './types/create-form-data';
import { CreateFormDataConfig, FormValue } from '../types/create-form-data';

import { getKeyString } from './utils/get-key-string';

/**
Expand All @@ -12,7 +13,13 @@ const fillFormData = (
config: CreateFormDataConfig,
formData: FormData
): void => {
const { keyPrefix, index, booleanMapper, allowNullableValues, allowEmptyValues } = config;
const {
keyPrefix,
index,
booleanMapper,
allowNullableValues,
allowEmptyValues,
} = config;

if (value === undefined || value === null) {
if (allowNullableValues && allowEmptyValues) {
Expand Down Expand Up @@ -44,8 +51,8 @@ const fillFormData = (
});
}
} else {
const simpleValue = value.toString();
if(simpleValue === '' && !allowEmptyValues){
const simpleValue = value.toString();
if (simpleValue === '' && !allowEmptyValues) {
return;
}
formData.append(keyPrefix, simpleValue);
Expand All @@ -63,7 +70,6 @@ export const createFormData = (
options?: Partial<CreateFormDataConfig>,
existingFormData?: FormData
): FormData => {

// create config from default and argument options
const config = Object.assign(
{
Expand Down
3 changes: 2 additions & 1 deletion src/lib/create-url-params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
ArrayRecordType,
CreateURLParamsConfig,
RecordValue,
} from './types/create-url-params';
} from '../types/create-url-params';

import { getKeyString } from './utils/get-key-string';

export const createURLParams = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type Value = PrimitiveTypes | Date | File | Blob;

type ArrayFormValue = Array<Record<string, FormValue> | FormValue>;

type FormValue =
export type FormValue =
| ArrayFormValue
| Record<string, ArrayFormValue | Value>
| Value;
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"incremental": true,
"target": "es2020",
"target": "es2015",
"outDir": "build/main",
"rootDir": "src",
"moduleResolution": "node",
Expand Down
11 changes: 0 additions & 11 deletions tsconfig.module.json

This file was deleted.

10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2326,6 +2326,11 @@
"shell-quote" "^1.6.1"
"string.prototype.padend" "^3.0.0"

"npmrc@^1.1.1":
"integrity" "sha512-uBbR8YNnIvKhMCDyz27Ffvnm2bLntMesFcwiz6Yp0DYSQB+JqgM1MocewFwMlItKCex+1ytii/+vmLhigO1qhg=="
"resolved" "https://registry.npmjs.org/npmrc/-/npmrc-1.1.1.tgz"
"version" "1.1.1"

"nwsapi@^2.2.2":
"integrity" "sha512-90yv+6538zuvUMnN+zCr8LuV6bPFdq50304114vJYJ8RDyK8D5O9Phpbd6SZWgI7PwzmmfN1upeOJlvybDSgCw=="
"resolved" "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.2.tgz"
Expand Down Expand Up @@ -3135,11 +3140,6 @@
"querystringify" "^2.1.1"
"requires-port" "^1.0.0"

"user@^0.0.0":
"integrity" "sha512-eRNM5isOvr6aEFAGi1CqAkmLkYxW2NJ5ThhbD+6IJXYKM1mo7Gtxx4mQIveHz/5K3p/SVnlW9k17ETn+QAu8IQ=="
"resolved" "https://registry.npmjs.org/user/-/user-0.0.0.tgz"
"version" "0.0.0"

"uuid@^8.3.2":
"integrity" "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
"resolved" "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
Expand Down

0 comments on commit 6991922

Please sign in to comment.