Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iomem

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iomem - npm Package Compare versions

Comparing version 1.4.5 to 1.5.0

index.d.ts

12

CHANGELOG.md
# Changelog
## [1.5.0](https://github.com/alexzel/iomem/compare/v1.4.5...v1.5.0) (2023-01-31)
### Features
* add TypeScript types ([5b678fe](https://github.com/alexzel/iomem/commit/5b678fed053905904f5d28154bd952988a05d2d2))
### Bug Fixes
* fix increment and decrement signatures in the readme ([dc53585](https://github.com/alexzel/iomem/commit/dc535854b5f7ac71ce9af09c3d7f4dc1ac0935e6))
## [1.4.5](https://github.com/alexzel/iomem/compare/v1.4.4...v1.4.5) (2023-01-30)

@@ -4,0 +16,0 @@

6

package.json
{
"name": "iomem",
"version": "1.4.5",
"version": "1.5.0",
"description": "Memcached client implementing binary protocol with native multiple keys support",

@@ -40,5 +40,7 @@ "keywords": [

"src",
"test"
"test",
"index.d.ts"
],
"main": "src/client.js",
"types": "index.d.ts",
"devDependencies": {

@@ -45,0 +47,0 @@ "@commitlint/cli": "^17.4.2",

@@ -213,6 +213,10 @@ # `iomem`

`incr(key, initial, delta, expiry): value` - increment counter and returns its value.
`incr(key, initial, delta, expiry): value|null` - increment counter and returns its value.
`decr(key, initial, delta, expiry): value` - decrement coutner and returns its value.
`incr([key1, ...], initial, delta, expiry): [value, ...]` - increment counter and returns its value for multiple keys.
`decr(key, initial, delta, expiry): value|null` - decrement counter and returns its value.
`decr([key1, ...], initial, delta, expiry): [value, ...]` - decrement counter and returns its value for multiple keys.
Paramters:

@@ -453,2 +457,1 @@

- Optional keys hashing
- Add types for TypeScript

@@ -435,68 +435,5 @@ 'use strict'

/* eslint-disable no-new-wrappers */
describe('serializer', () => {
it('reads and writes various data types', async () => {
// integer
await iomem.set('test:foo', 10)
expect(await iomem.get('test:foo')).toBe(10)
// float
await iomem.set('test:foo', 3.14)
expect(await iomem.get('test:foo')).toBe(3.14)
// boolean
await iomem.set('test:foo', true)
expect(await iomem.get('test:foo')).toBe(true)
// string
await iomem.set('test:foo', 'abc')
expect(await iomem.get('test:foo')).toBe('abc')
// String
await iomem.set('test:foo', new String('abc'))
expect(await iomem.get('test:foo')).toStrictEqual(new String('abc'))
// BigInt
await iomem.set('test:foo', 100n)
expect(await iomem.get('test:foo')).toBe(100n)
// Date
const date = new Date()
await iomem.set('test:foo', date)
expect(await iomem.get('test:foo')).toStrictEqual(date)
// Buffer
const buffer = Buffer.from(['a', 'b', 'c'])
await iomem.set('test:foo', buffer)
expect(await iomem.get('test:foo')).toStrictEqual(buffer)
// array
await iomem.set('test:foo', [1, 2])
expect(await iomem.get('test:foo')).toStrictEqual([1, 2])
// object
const obj = {
int: 10,
float: 3.14,
bool: true,
str: 'abc',
Str: new String('abc'),
big: 100n,
date: new Date(),
buf: Buffer.from(['a', 'b', 'c']),
arr: [1, 2],
obj: {
a: 1000,
b: true,
d: new Date()
}
}
await iomem.set('test:foo', obj)
expect(await iomem.get('test:foo')).toStrictEqual(obj)
})
})
describe('quit', () => {
it('closes connection', async () => {
// close all servers
// end all sockets
iomem.end()

@@ -844,2 +781,65 @@

})
/* eslint-disable no-new-wrappers */
describe('serializer', () => {
it('reads and writes various data types', async () => {
// integer
await iomem.set('test:foo', 10)
expect(await iomem.get('test:foo')).toBe(10)
// float
await iomem.set('test:foo', 3.14)
expect(await iomem.get('test:foo')).toBe(3.14)
// boolean
await iomem.set('test:foo', true)
expect(await iomem.get('test:foo')).toBe(true)
// string
await iomem.set('test:foo', 'abc')
expect(await iomem.get('test:foo')).toBe('abc')
// String
await iomem.set('test:foo', new String('abc'))
expect(await iomem.get('test:foo')).toStrictEqual(new String('abc'))
// BigInt
await iomem.set('test:foo', 100n)
expect(await iomem.get('test:foo')).toBe(100n)
// Date
const date = new Date()
await iomem.set('test:foo', date)
expect(await iomem.get('test:foo')).toStrictEqual(date)
// Buffer
const buffer = Buffer.from(['a', 'b', 'c'])
await iomem.set('test:foo', buffer)
expect(await iomem.get('test:foo')).toStrictEqual(buffer)
// array
await iomem.set('test:foo', [1, 2])
expect(await iomem.get('test:foo')).toStrictEqual([1, 2])
// object
const obj = {
int: 10,
float: 3.14,
bool: true,
str: 'abc',
Str: new String('abc'),
big: 100n,
date: new Date(),
buf: Buffer.from(['a', 'b', 'c']),
arr: [1, 2],
obj: {
a: 1000,
b: true,
d: new Date()
}
}
await iomem.set('test:foo', obj)
expect(await iomem.get('test:foo')).toStrictEqual(obj)
})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc