elysia 0.2.0-rc.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ Building on top of 3 philosophies:
21
21
  - Simplicity
22
22
  - Simple building blocks to create an abstraction, not repeating yourself
23
23
  - Flexibility
24
- - You shall be able to customize most of the library to fits your need
24
+ - You shall be able to customize most of the library to fit your needs
25
25
 
26
26
  Designed with TypeScript in mind, you don't need to understand TypeScript to gain the benefit of TypeScript with Elysia. The library understands what you want and automatically infers the type from your code.
27
27
 
package/dist/index.js CHANGED
@@ -236,14 +236,17 @@ export default class Elysia {
236
236
  return this;
237
237
  }
238
238
  state(name, value) {
239
- ;
240
- this.store[name] = value;
239
+ if (!(name in this.store)) {
240
+ ;
241
+ this.store[name] = value;
242
+ }
241
243
  return this;
242
244
  }
243
245
  decorate(name, value) {
244
246
  if (!this.decorators)
245
247
  this.decorators = {};
246
- this.decorators[name] = value;
248
+ if (!(name in this.decorators))
249
+ this.decorators[name] = value;
247
250
  return this;
248
251
  }
249
252
  derive(transform) {
@@ -457,7 +460,10 @@ export default class Elysia {
457
460
  return Promise.all(this.lazyLoadModules);
458
461
  }
459
462
  setModel(record) {
460
- Object.assign(this.store[DEFS], record);
463
+ Object.entries(record).forEach(([key, value]) => {
464
+ if (!(key in this.store[DEFS]))
465
+ this.store[DEFS][key] = value;
466
+ });
461
467
  return this;
462
468
  }
463
469
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elysia",
3
3
  "description": "Fast, and friendly Bun web framework",
4
- "version": "0.2.0-rc.1",
4
+ "version": "0.2.0",
5
5
  "author": {
6
6
  "name": "saltyAom",
7
7
  "url": "https://github.com/SaltyAom",