Skip to content

Commit

Permalink
chore(release): v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcachips authored and Marcachips committed Jun 11, 2023
1 parent ad18d50 commit b5a5525
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 17 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

# [1.4.0](https://github.com/klientjs/core/compare/1.3.1...1.4.0) (2023-06-11)


### Features

* reduce complexity of bag class used by services and parameters ([ad18d50](https://github.com/klientjs/core/commit/ad18d50533095322cf7abba13615a84b2264aad7))

## [1.3.1](https://github.com/klientjs/core/compare/1.3.0...1.3.1) (2023-06-11)


Expand Down
4 changes: 2 additions & 2 deletions dist/cjs/services/bag.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare type BagItems = Record<string, unknown>;
export default class Bag {
private items;
export default class Bag implements BagItems {
[x: string]: unknown;
constructor(items?: BagItems);
get(path: string): any;
set(path: string, value: unknown): this;
Expand Down
19 changes: 14 additions & 5 deletions dist/cjs/services/bag.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,33 @@ const deepmerge = require("deepmerge");
const objectPath = require("object-path");
class Bag {
constructor(items = {}) {
this.items = items;
Object.keys(items).forEach((key) => {
this.set(key, items[key]);
});
}
get(path) {
return objectPath.get(this.items, path);
return objectPath.get(this, path);
}
set(path, value) {
objectPath.set(this.items, path, value);
objectPath.set(this, path, value);
return this;
}
merge(...items) {
this.items = deepmerge.all([this.items, ...items], {
const nextState = deepmerge.all([this, ...items], {
arrayMerge: (_destinationArray, sourceArray) => sourceArray,
isMergeableObject: (o) => (o === null || o === void 0 ? void 0 : o.constructor) === Array || (o === null || o === void 0 ? void 0 : o.constructor) === Object
});
Object.keys(nextState).forEach((key) => {
this.set(key, nextState[key]);
});
return this;
}
all() {
return this.items;
const all = {};
Object.keys(this).forEach((key) => {
all[key] = this[key];
});
return all;
}
}
exports.default = Bag;
4 changes: 2 additions & 2 deletions dist/esm/services/bag.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare type BagItems = Record<string, unknown>;
export default class Bag {
private items;
export default class Bag implements BagItems {
[x: string]: unknown;
constructor(items?: BagItems);
get(path: string): any;
set(path: string, value: unknown): this;
Expand Down
19 changes: 14 additions & 5 deletions dist/esm/services/bag.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,32 @@ import * as deepmerge from 'deepmerge';
import * as objectPath from 'object-path';
export default class Bag {
constructor(items = {}) {
this.items = items;
Object.keys(items).forEach((key) => {
this.set(key, items[key]);
});
}
get(path) {
return objectPath.get(this.items, path);
return objectPath.get(this, path);
}
set(path, value) {
objectPath.set(this.items, path, value);
objectPath.set(this, path, value);
return this;
}
merge(...items) {
this.items = deepmerge.all([this.items, ...items], {
const nextState = deepmerge.all([this, ...items], {
arrayMerge: (_destinationArray, sourceArray) => sourceArray,
isMergeableObject: (o) => (o === null || o === void 0 ? void 0 : o.constructor) === Array || (o === null || o === void 0 ? void 0 : o.constructor) === Object
});
Object.keys(nextState).forEach((key) => {
this.set(key, nextState[key]);
});
return this;
}
all() {
return this.items;
const all = {};
Object.keys(this).forEach((key) => {
all[key] = this[key];
});
return all;
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"axios",
"sdk"
],
"version": "1.3.1",
"version": "1.4.0",
"license": "MIT",
"main": "./dist/cjs/index.js",
"types": "./dist/cjs/index.d.ts",
Expand Down

0 comments on commit b5a5525

Please sign in to comment.