flatten-ihe
Advanced tools
Comparing version 0.0.1 to 0.0.2
export type T = Record<string, any>; | ||
export default function flattenObject(obj: T, sep?: string): T; | ||
export default function flattenIhe(obj: T, sep?: string): T; |
@@ -5,3 +5,3 @@ /** | ||
export default function flattenObject(obj, sep = '.') { | ||
export default function flattenIhe(obj, sep = '.') { | ||
const result = {} | ||
@@ -8,0 +8,0 @@ |
{ | ||
"name": "flatten-ihe", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Flatten javascript objects to a single level", | ||
@@ -12,3 +12,3 @@ "type": "module", | ||
"type": "git", | ||
"url": "git+https://github.com/nwaughachukwuma/flatten-object.git" | ||
"url": "git+https://github.com/nwaughachukwuma/flatten-ihe.git" | ||
}, | ||
@@ -29,5 +29,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/nwaughachukwuma/flatten-object/issues" | ||
"url": "https://github.com/nwaughachukwuma/flatten-ihe/issues" | ||
}, | ||
"homepage": "https://github.com/nwaughachukwuma/flatten-object#readme", | ||
"homepage": "https://github.com/nwaughachukwuma/flatten-ihe#readme", | ||
"devDependencies": { | ||
@@ -34,0 +34,0 @@ "ava": "^3.15.0", |
@@ -1,4 +0,4 @@ | ||
# flatten-object | ||
# flatten-ihe | ||
Flatten javascript objects to a single level, with the ability to choose delimiter/separator. | ||
Flatten javascript objects to a single level, with the ability to choose delimiter/separator. Ihe is an Igbo word for Object. | ||
@@ -8,7 +8,7 @@ ## Installation | ||
```bash | ||
pnpm install flatten-object | ||
pnpm install flatten-ihe | ||
yarn add flatten-object | ||
yarn add flatten-ihe | ||
npm install flatten-object | ||
npm install flatten-ihe | ||
``` | ||
@@ -19,3 +19,3 @@ | ||
```js | ||
import flattenObject from 'flatten-object' | ||
import flattenIhe from 'flatten-ihe' | ||
// 1. as a simple object flattener | ||
@@ -34,5 +34,5 @@ | ||
const result = flattenObject(obj) | ||
const result = flattenIhe(obj) | ||
// result : => | ||
// result : => | ||
{ | ||
@@ -48,3 +48,3 @@ 'status': 'success', | ||
const sep = '_' | ||
const result = flattenObject(obj, sep) | ||
const result = flattenIhe(obj, sep) | ||
@@ -81,3 +81,3 @@ // result :=> | ||
const sep = '/' | ||
const result = flattenObject(obj, sep) | ||
const result = flattenIhe(obj, sep) | ||
@@ -102,3 +102,3 @@ // result :=> | ||
```ts | ||
flattenObject(obj: {[key: string]: any}, sep: string) | ||
flattenIhe(obj: {[key: string]: any}, sep: string) | ||
``` | ||
@@ -105,0 +105,0 @@ |
import test from 'ava' | ||
import flattenObject from './index.js' | ||
import flattenIhe from './index.js' | ||
@@ -16,3 +16,3 @@ const obj = { | ||
test('can flatten a nested object', (t) => { | ||
const result = flattenObject(obj) | ||
const result = flattenIhe(obj) | ||
t.deepEqual(result, { | ||
@@ -28,3 +28,3 @@ 'status': 'success', | ||
const sep = '_' | ||
const result = flattenObject(obj, sep) | ||
const result = flattenIhe(obj, sep) | ||
t.deepEqual(result, { | ||
@@ -60,3 +60,3 @@ 'status': 'success', | ||
const sep = '/' | ||
const result = flattenObject(api, sep) | ||
const result = flattenIhe(api, sep) | ||
t.deepEqual(result, { | ||
@@ -63,0 +63,0 @@ 'users/getUser': api.users.getUser, |
Sorry, the diff of this file is not supported yet
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
6218