@esentri/transformer-functions
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

Transformer Functions

Build Status Coverage Status npm version

Simple functions for transforming from one data type into another.

Install

npm install @esentri/transformer-functions
yarn add @esentri/transformer-functions

Usage

Choose the needed function from the table (left = from, top = to):

From \ To String HexString ArrayBuffer Uint8Array Base64 ArrayObject
String - X X X X -
HexString X - X X X -
ArrayBuffer X X - X X X
Uint8Array X X X - X X
Base64 X X X X - -
ArrayObject - - X X - -

The corresponding method will be called:

[Type]To[Type] e.g.: StringToArrayBuffer [Type]WithBinaryDataTo[Type]: if you need to transform binary data

NOTE: String, HexString, and Base64 are all of type string. They differ in the way what they represent (and therefor in the way they are handled).

Special Types

HexString: A string that contains only hex values (e.g. 68656c6c6f20776f726c64). ArrayObject: An object that can be transformed to an array (e.g. {0: 10, 1: 298, 2: 233})

Projects used

Typescript Library Starter dependencies

License

MIT License

Copyright (c) 2018 esentri AG

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

none

Package Sidebar

Install

npm i @esentri/transformer-functions

Weekly Downloads

0

Version

0.6.0

License

MIT

Unpacked Size

62.7 kB

Total Files

26

Last publish

Collaborators

  • esentri-admin
  • maurice-mueller
  • yannick.meny