@k3000/store 0.3.0 → 0.4.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/architect.mjs CHANGED
@@ -452,9 +452,7 @@ export class Entities extends Array {
452
452
  this.#storage.needSave = true
453
453
  }
454
454
 
455
- const result = []
456
-
457
- for (const item of items) {
455
+ return items.map(item => {
458
456
 
459
457
  let position
460
458
 
@@ -471,10 +469,8 @@ export class Entities extends Array {
471
469
 
472
470
  this.#record.push(position)
473
471
 
474
- result.push(this.#assign(position, item))
475
- }
476
-
477
- return result
472
+ return this.#assign(position, item)
473
+ })
478
474
  }
479
475
 
480
476
  pop() {
@@ -500,7 +496,7 @@ export class Entities extends Array {
500
496
  this.#storage.needSave = true
501
497
  }
502
498
 
503
- for (const item of items) {
499
+ return items.map(item => {
504
500
 
505
501
  let position
506
502
 
@@ -517,10 +513,8 @@ export class Entities extends Array {
517
513
 
518
514
  this.#record.unshift(position)
519
515
 
520
- this.#assign(position, item)
521
- }
522
-
523
- return items.length
516
+ return this.#assign(position, item)
517
+ })
524
518
  }
525
519
 
526
520
  shift() {
@@ -1302,7 +1296,7 @@ const s2b = (value, length) => {
1302
1296
 
1303
1297
  let len = 0
1304
1298
 
1305
- for (let i = value.length - 1; i >= 0; i--) {
1299
+ for (let i = 0; i < value.length; i++) {
1306
1300
 
1307
1301
  const byteLength = Buffer.byteLength(value[i])
1308
1302
 
@@ -1311,7 +1305,7 @@ const s2b = (value, length) => {
1311
1305
  len += byteLength
1312
1306
  }
1313
1307
 
1314
- buffer = buffer.subarray(buffer.length - len)
1308
+ buffer = buffer.subarray(0, len)
1315
1309
  }
1316
1310
 
1317
1311
  return Buffer.concat([Buffer.alloc(length - buffer.length), buffer])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k3000/store",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "storage",
5
5
  "main": "generator.mjs",
6
6
  "scripts": {
package/test/1/data CHANGED
Binary file
package/test/1/index CHANGED
Binary file
package/test/2/data CHANGED
Binary file
package/test/2/index CHANGED
Binary file
package/test/3/data CHANGED
Binary file
package/test/3/index CHANGED
Binary file
package/test/4/data CHANGED
Binary file
package/test/4/index CHANGED
Binary file
package/test/5/data CHANGED
Binary file
package/test/5/index CHANGED
Binary file
package/test/6/data CHANGED
Binary file
package/test/6/index CHANGED
Binary file
package/test/7/data CHANGED
Binary file
package/test/7/index CHANGED
Binary file