{"id":1139,"date":"2012-10-12T00:40:45","date_gmt":"2012-10-12T06:40:45","guid":{"rendered":"http:\/\/bateru.com\/news\/?p=1139"},"modified":"2012-10-12T00:41:43","modified_gmt":"2012-10-12T06:41:43","slug":"ratio-js-fractions-for-javascript","status":"publish","type":"post","link":"https:\/\/bateru.com\/news\/2012\/10\/ratio-js-fractions-for-javascript\/","title":{"rendered":"Ratio.js &#8211; Fractions for javascript"},"content":{"rendered":"<p><a href=\"http:\/\/www.flickr.com\/photos\/roboppy\/2930201895\/\"><img decoding=\"async\" src=\"http:\/\/farm4.staticflickr.com\/3208\/2930201895_c01e1516f2.jpg\"\/><\/a><\/p>\n<p>Hey Everyone,<br \/>\nI created a project called <a href=\"https:\/\/github.com\/LarryBattle\/Ratio.js\">Ratio.js<\/a>. Basically the goal of the project is to provide an simple object for dealing with fractions in javascript.<br \/>\nCheck it out here and tell me what this.<\/p>\n<h2><a href=\"https:\/\/github.com\/LarryBattle\/Ratio.js\">Ratio.js<\/a><\/h2>\n<p>Sample Code<br \/>\n<code><\/p>\n<pre lang='javascript'>\r\n\r\n\/\/ converts decimal values into the form of a fraction.\r\na = Ratio.parse(1\/2);\r\na.toString() == \"1\/2\";\r\n\r\n\/\/ converts strings in the form of \"a\/b\" to a fraction a\/b.\r\na = Ratio.parse( \"1\/2\" );\r\na.toString() == \"1\/2\";\r\n\r\nvar result = Ratio.parse( 12.12121212121212 ).reduce().toString();\r\nresult == \"400\/33\";\r\n\r\n<\/pre>\n<p><\/code><\/p>\n<h2><a href=\"http:\/\/larrybattle.github.com\/Ratio.js\/demo\/demo-basic.html\">Simple Demo<\/a><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Hey Everyone, I created a project called Ratio.js. Basically the goal of the project is to provide an simple object for dealing with fractions in javascript. Check it out here and tell me what this. Ratio.js Sample Code \/\/ converts decimal values into the form of a fraction. a = Ratio.parse(1\/2); a.toString() == &#8220;1\/2&#8221;; \/\/ &hellip; <a href=\"https:\/\/bateru.com\/news\/2012\/10\/ratio-js-fractions-for-javascript\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Ratio.js &#8211; Fractions for javascript<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,23],"tags":[148,189,164,166,147],"class_list":["post-1139","post","type-post","status-publish","format-standard","hentry","category-frontend-tech","category-math","tag-fractions","tag-github","tag-javascript","tag-math","tag-ratio-js"],"_links":{"self":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts\/1139","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/comments?post=1139"}],"version-history":[{"count":5,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts\/1139\/revisions"}],"predecessor-version":[{"id":1144,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/posts\/1139\/revisions\/1144"}],"wp:attachment":[{"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/media?parent=1139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/categories?post=1139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bateru.com\/news\/wp-json\/wp\/v2\/tags?post=1139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}