@small-tech/message-type

1.0.0 • Public • Published

@small-tech/message-type

A basic utility for deriving key paths from an object-tree schema for use in creating statically-typed, unique message names for socket communication.

Usage

import messageType from '@small-tech/message-type'

const MessageType = messageType({
  settings: null,
  dns: {
    validate: {
      request: null,
      response: null,
      progress: null
    }
  }
})

console.log(MessageType.settings) // 'settings'
console.log(MessageType.dns.validate.request)  // 'dns.validate.request'
console.log(MessageType.dns.validate.response) // 'dns.validate.response'
console.log(MessageType.dns.validate.progress) // 'dns.validate.progress'

Test

npm run test

Coverage

npm run coverage

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.

Copyright

© 2021-present Aral Balkan, Small Technology Foundation.

License

ISC

Package Sidebar

Install

npm i @small-tech/message-type

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

4.76 kB

Total Files

6

Last publish

Collaborators

  • aral