Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brooksn/canonical-tent-json
Generate canonical JSON for Tent posts
https://github.com/brooksn/canonical-tent-json
Last synced: about 2 months ago
JSON representation
Generate canonical JSON for Tent posts
- Host: GitHub
- URL: https://github.com/brooksn/canonical-tent-json
- Owner: brooksn
- Created: 2015-06-19T07:50:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-10T06:39:05.000Z (over 9 years ago)
- Last Synced: 2024-10-08T12:40:55.248Z (3 months ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# canonical-tent-json
Generate canonical JSON for Tent posts. For [Tent 0.3](https://tent.io/docs/posts#canonical-post-json).[![npm version](https://badge.fury.io/js/canonical-tent-json.svg)](http://badge.fury.io/js/canonical-tent-json)
[![Build Status](https://travis-ci.org/brooksn/canonical-tent-json.svg)](https://travis-ci.org/brooksn/canonical-tent-json)## Installation
```shell
$ npm install canonical-tent-json
```## Usage
```js
var canonical = require('canonical-tent-json');
var post = {
"original_entity": "https://example.com",
"entity": "https://example.net",
"type": "https://tent.io/types/status/v0",
"content": {
"text": "Hello world!"
},
"published_at": 1450396800
};var newcanonicalpost = canonical(post);
Object.is(post, newcanonicalpost); //false
var version_id = newcanonicalpost.versionID();
//sha512t256-8c71c9113e53a23eaf1a7ac763e8759f2aa88cb73d50564a6c0ba46263e851d1
```