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

typeson-registry

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typeson-registry - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

5

package.json
{
"name": "typeson-registry",
"version": "0.6.0",
"version": "0.6.1",
"description": "Official registry for typeson type definitions",

@@ -31,3 +31,4 @@ "scripts": {

"base64-arraybuffer": "^0.1.5"
}
},
"tonicExample": "var Typeson = require('typeson');\nvar TSON = new Typeson().register(require('typeson-registry/presets/builtin'));\n\nTSON.stringify({foo: new Date()});"
}

58

README.md

@@ -7,3 +7,3 @@ # typeson-registry

# usage
# usage (node)

@@ -17,2 +17,3 @@ ```js

require('typeson-registry/types/typed-arrays'),
// ...
]);

@@ -59,8 +60,61 @@

assert(parsedBack.date instanceof Date);
assert(parsedBack.binary instanceof Uint8Array);
assert(parsedBack.inner.bin instanceof Uint8Array);
```
# usage (browser)
This sample uses plain script tags. All types and presets under dist are UMD modules so you can require using requirejs as well.
```html
<!DOCTYPE html>
<html>
<head>
<script src="//npmcdn.com/typeson/dist/typeson.js"></script>
<script src="//npmcdn.com/typeson-registry/dist/presets/builtin.js"></script>
<script>
var TSON = new Typeson().register(Typeson.presets.builtin);
var tson = TSON.stringify({
Hello: "world",
date: new Date(),
error: new Error(),
inner: {
x: /foo/ig,
bin: new Uint8Array(64)
}
}, null, 2);
alert(tson);
/* Alerts:
{
"Hello": "world",
"date": 1464049031538,
"error": {
"name": "Error",
"message": ""
},
"inner": {
"x": {
"source": "foo",
"flags": "gi"
},
"bin": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
},
"$types": {
"date": "Date",
"error": "Error",
"inner.x": "RegExp",
"inner.bin": "Uint8Array"
}
}
*/
</script>
</head>
</html>
```
# see also
* [typeson](https://github.com/dfahlander/typeson)
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