{"id":20664505,"url":"https://github.com/outr/perfolation","last_synced_at":"2025-04-09T17:25:07.844Z","repository":{"id":30478621,"uuid":"125060068","full_name":"outr/perfolation","owner":"outr","description":"Performance focused interpolation","archived":false,"fork":false,"pushed_at":"2025-03-23T00:26:15.000Z","size":156,"stargazers_count":30,"open_issues_count":11,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T11:52:57.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/outr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-13T13:58:08.000Z","updated_at":"2024-05-10T13:54:43.000Z","dependencies_parsed_at":"2024-05-09T15:28:27.949Z","dependency_job_id":"34ca9f9a-2161-49d6-97ab-26ea4089def7","html_url":"https://github.com/outr/perfolation","commit_stats":{"total_commits":129,"total_committers":7,"mean_commits":"18.428571428571427","dds":0.1705426356589147,"last_synced_commit":"9142c06b280bec5a1c9c72b697c792f315d02969"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fperfolation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fperfolation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fperfolation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outr%2Fperfolation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outr","download_url":"https://codeload.github.com/outr/perfolation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075791,"owners_count":21043648,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T19:24:42.318Z","updated_at":"2025-04-09T17:25:07.818Z","avatar_url":"https://github.com/outr.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# perfolation\n[![Build Status](https://travis-ci.org/outr/perfolation.svg?branch=master)](https://travis-ci.org/outr/perfolation)\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/outr/perfolation)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.outr/perfolation_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.outr/perfolation_2.12)\n[![Latest version](https://index.scala-lang.org/outr/perfolation/perfolation/latest.svg)](https://index.scala-lang.org/outr/perfolation)\n\nOriginally designed for interpolation performance improvements, but as Scala's built-in interpolation has improved, this\nhas become redundant. However, formatted interpolation is still both slow and painful to work with. To that end, this\nlibrary has changed to providing convenient features for formatting dates and numbers.\n\n## Setup\n\nPerfolation supports Scala on JVM, JS, and Native with support for 2.11, 2.12, 2.13, and 3\n\nLoad the core dependency with SBT:\n```sbt\nlibraryDependencies += \"com.outr\" %% \"perfolation\" % \"1.2.5\"\n```\n\nOr the `unit` dependency for size conversions with SBT:\n```sbt\nlibraryDependencies += \"com.outr\" %% \"perfolation-unit\" % \"1.2.5\"\n```\n\n## Main Features\n\n### Numeric Formatting\n\nNumeric implicits are supported for `Int`, `Long`, `Double`, and `BigDecimal` exposing a simple method `f`:\n\n```scala\ndef f(i: Int,               // Minimum integer digits. Defaults to 1\n      f: Int = 0,           // Minimum fraction digits. Defaults to 0 for Int/Long and 2 for Double/BigDecimal \n      maxI: Int,            // Maximum integer digits. Defaults to -1 for no maximum\n      maxF: Int,            // Maximum fraction digits. Defaults to -1 to use the same as `f`\n      g: Grouping,          // Grouping mode (Defaults to Grouping.None)\n      rm: RoundingMode      // Rounding mode (Defaults to RoundingMode.HalfUp)\n     ): String\n```\n\nSome simple examples:\n```scala\nimport perfolation._\n\n4.f(i = 2)                            // 04\n40.f(f = 2)                           // 40.00\n400.0.f()                             // 400.00\n4000.0.f(f = 3, g = Grouping.US)      // 4,000.000\n```\n\nMost of this follows a similar concept to `f` interpolation, but with a type-safe mechanism. Most commonly, you are\nlikely to find this useful in interpolations like:\n```scala\nprintln(s\"The value is: ${value.f(g = Grouping.US)}\")\n```\n\n### Date Formatting\n\nPerfolation provides a convenient `CrossDate` to make working with dates much easier between the JVM, JS, and Native.\nSimilar to numeric formatting, date implicits are supported for `Int`, `Long`, `Double`, and `BigDecimal` although this\nis most commonly just used on `Long` for timestamps. Perfolation exposes a simple method `t`:\n\n```scala\ndef t: CrossDate\n```\n\nSome simple examples:\n```scala\nimport perfolation._\n\nval date = System.currentTimeMillis()\ndate.t.milliseconds                 // Milliseconds on date\ndate.t.hour24                       // Hour in 24-hour time\ndate.t.dayOfWeek                    // Numeric day of the week\ndate.t.A                            // Full named day of the week (ex. \"Tuesday\")\n```\n\nSee the docs for `CrossDate` for a complete reference.\n\n### Unit Formatting\n\nUnit formatting requires the `perfolation-unit` module, but provides conversion between byte-based sizes. For example:\n```scala\nimport perfolation.unit._\n\nInformation.useBinary()       // Configure Information to use binary conversions\n5.kb.bytes                    // 5120L\n5.gb.bytes                    // 5368709120L\n\nInformation.useDecimal()      // Configure Information to use decimal conversions\n5.kb.bytes                    // 5000L\n5.gb.bytes                    // 5000000000L\n\n(5 * 1000 * 1000).b.format()  // \"5.00 mb\"\n```\n\nThe `format` method has a similar signature to that of `f` in numeric formatting:\n```scala\ndef format(i: Int = 1,\n           f: Int = 2,\n           maxI: Int = -1,\n           maxF: Int = -1,\n           g: Grouping = Grouping.None,\n           rm: RoundingMode = RoundingMode.HalfUp,\n           showUnit: ShowUnit = ShowUnit.Abbreviation): String\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutr%2Fperfolation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutr%2Fperfolation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutr%2Fperfolation/lists"}