{"id":13805585,"url":"https://github.com/ember-cli/ember-compatibility-helpers","last_synced_at":"2025-06-24T11:06:55.890Z","repository":{"id":23313966,"uuid":"98664262","full_name":"ember-cli/ember-compatibility-helpers","owner":"ember-cli","description":"Helpers that allow you to write backwards compat Ember addons","archived":false,"fork":false,"pushed_at":"2024-02-04T00:52:55.000Z","size":795,"stargazers_count":25,"open_issues_count":9,"forks_count":20,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-05T08:24:25.865Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ember-cli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-07-28T15:44:04.000Z","updated_at":"2024-10-25T08:15:15.000Z","dependencies_parsed_at":"2023-09-06T18:16:03.998Z","dependency_job_id":"1cc78250-23d9-47cc-a774-f521400db235","html_url":"https://github.com/ember-cli/ember-compatibility-helpers","commit_stats":null,"previous_names":["pzuraq/ember-compatibility-helpers"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/ember-cli/ember-compatibility-helpers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-compatibility-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-compatibility-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-compatibility-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-compatibility-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ember-cli","download_url":"https://codeload.github.com/ember-cli/ember-compatibility-helpers/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ember-cli%2Fember-compatibility-helpers/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259759786,"owners_count":22907042,"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-08-04T01:01:02.664Z","updated_at":"2025-06-24T11:06:55.859Z","avatar_url":"https://github.com/ember-cli.png","language":"JavaScript","funding_links":[],"categories":["Packages"],"sub_categories":["Component addons"],"readme":"[![Build Status](https://travis-ci.org/pzuraq/ember-compatibility-helpers.svg?branch=master)](https://travis-ci.org/pzuraq/ember-compatibility-helpers) [![npm version](https://badge.fury.io/js/ember-compatibility-helpers.svg)](https://badge.fury.io/js/ember-compatibility-helpers)\n\n# ember-compatibility-helpers\n\nProvides flags for features in Ember, allowing you to write code that will work\nwith whatever version the consuming application is on. This addon is intended\nto help addon authors write backwards/forwards compatibility code.\n\nThe flags are replaced at build time with boolean literals (`true` or `false`)\nby a Babel transform. When ran through a minifier (with dead code elimination) the entire section will be stripped, meaning that the section of code which is not used\nwill not be added to production builds - zero cost compatibility!\n\n## Installation\n\n```\nember install ember-compatibility-helpers\n```\n\n## Available Flags\n\n```js\nimport {\n  // General functions for checking against Ember version\n  gte,\n  lte,\n\n  // Flags for specific Ember functionality\n  HAS_UNDERSCORE_ACTIONS,\n  HAS_MODERN_FACTORY_INJECTIONS,\n\n  IS_GLIMMER_2,\n  IS_RECORD_DATA,\n\n  SUPPORTS_FACTORY_FOR,\n  SUPPORTS_GET_OWNER,\n  SUPPORTS_SET_OWNER,\n  SUPPORTS_NEW_COMPUTED,\n  SUPPORTS_INVERSE_BLOCK,\n  SUPPORTS_CLOSURE_ACTIONS,\n  SUPPORTS_UNIQ_BY_COMPUTED\n} from 'ember-compatibility-helpers';\n```\n\nMore welcome, open an issue or a PR!\n\n## Version Identifiers\n\nVersion strings passed to version checker functions, such as `gte` or `lte`, must be fully qualified versions. Version ranges or shorthands are not supported.\n\n```\n// Do this:\nlte('3.13.0-beta.1')\n\n// Not this:\nlte('3.12'); // won't work!\nlte('^3.12.0'); // won't work!\n```\n\n## Example Usage for testing ember-source versions\n\n```js\nimport Component from '@glimmer/component';\nimport { get } from '@ember/object';\n\nimport { gte } from 'ember-compatibility-helpers';\n\nexport default class MyComponent extends Component {\n  get aProp() {\n    if (gte('4.0.0')) {\n      return this.args.aProxy.name;\n    } else {\n      return get(this.args.aProxy, 'name');\n    }\n  }  \n}\n```\n\n## Example Usage for testing other addon package versions\n\n```js\nimport Component from '@glimmer/component';\nimport { get } from '@ember/object';\n\nimport { gte } from 'ember-compatibility-helpers';\n\nexport default class MyComponent extends Component {\n  get aProp() {\n    if (gte('my-ember-addon', '1.2.3')) {\n      return this.args.newProp;\n    } else {\n      return this.args.oldProp;\n    }\n  }  \n}\n```\n\n## Example Flag usage:\n\n```javascript\nimport Component from '@ember/component';\nimport { computed } from '@ember/object';\n\nimport { SUPPORTS_NEW_COMPUTED } from 'ember-compatibility-helpers';\n\nfunction fooMacro() {\n  if (SUPPORTS_NEW_COMPUTED) {\n    return computed({\n      get() {\n        return this.get('foo');\n      },\n\n      set(key, value) {\n        this.set('foo', value);\n        return value\n      }\n    });\n  } else {\n    return computed(function(key, value) {\n      if (arguments.length === 2) {\n        this.set('foo', value);\n        return value;\n      }\n\n      return this.get('foo');\n    })\n  }\n}\n\nexport default Component.extend({\n  bar: fooMacro()\n});\n```\n\n## Development\n\n* `git clone \u003crepository-url\u003e` this repository\n* `cd ember-compatibility-helpers`\n* `yarn`\n\n## Running Tests\n\n* `npm test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fember-cli%2Fember-compatibility-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fember-cli%2Fember-compatibility-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fember-cli%2Fember-compatibility-helpers/lists"}