Fabien avatar

Steem.js Update v0.3: Added Formatters and Examples

fabien

Published: 19 Aug 2016 › Updated: 19 Aug 2016Steem.js Update v0.3: Added Formatters and Examples

Steem.js Update v0.3: Added Formatters and Examples

Hey JS developers!

I've release an update of Steem.js. Basically it's now including more examples on the test.js file and formatting methods to turn a VEST number to Steem Power and to turn a reputation number to a readable number.

The package is now separate in 2 objects. The first is the steem.api and second is steem.formatter. The API are the standard methods for exploring and interact with the blockchain and formatter will be used to make easy for you to turn a raw data to readable data. Did you ever tried to turn a reputation number to a % like they does in steemit.com? Here is how i would do with steem package:

steem.api.getAccounts(['dan'], function(err, result) {
    var reputation = steem.formatter.reputation(result[0].reputation);
    console.log(reputation);
});

Some others examples:

Get the content of steemit.com/tag/steemit

steem.api.getState('trending/steemit', function(err, result) {
    console.log(err, result);
});

Did you know that work for most of the url? try with '@fabien/posts' or '@fabien/feed' or 'hot'.

Stream operations and log the ones that concern only you

steem.api.streamOperations(function(err, result) {
    if (!err && result[1].author == 'fabien') {
        console.log(result);
    }
});

Get 10 followings of ned@ned

steem.api.getFollowing('ned', 0, 'blog', 10, function(err, result) {
    console.log(result);
});

Get more examples on the test.js file available on GitHub or the NPM package:

https://www.npmjs.com/package/steem
https://github.com/adcpm/steem

Want to help?

I'm looking for contributor for Steem.js, Steem API and others Open Source Steem projects. Interested? Contact me on the rocket chat my username is fabien@fabien, or on the channel #steemjs. There is a lot stuff to do, i can put you on track. All the Steem Dollar rewards of this article will be used to pay contributor to improve these Steem Open Source projects.

Best

Leave Steem.js Update v0.3: Added Formatters and Examples to:

Written by

The less code you use, the less there is to break

Read more #steemjs posts


Best Posts From Fabien

We have not curated any of fabien's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Fabien