Posts

CBOR - JSON Encoding

Compact Binary Format for JSON Data Transfer

When you wish to use JSON for its convenience, but also want to send the JSON using a more compact representation to save data that needs to be transfer, you will need to use an information encoder for JSON. These encoders tend to represent the JSON data in binary format for transfer and there are many out there.

Categories: #JavaScript
Tags: #NodeJs
TypeScript - String Enum for Checking Value Type

Ramda's Type Check

Ramda's type checking returns a string, but in order for this to be useful, one needs to know if the returned value matches your intended assertion.

R.type({}); //=> "Object"
R.type(1); //=> "Number"
R.type(false); //=> "Boolean"
R.type('s'); //=> "String"
R.type(null); //=> "Null"
R.type([]); //=> "Array"
R.type(/[A-z]/); //=> "RegExp"
R.type(() => {}); //=> "Function"
R.type(undefined); //=> "Undefined"
Categories: #typescript