New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-version-is

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-version-is

Dead simple in browser Ember / Ember Data version checker. Works with Ember Addons.

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
85
increased by10.39%
Maintainers
1
Weekly downloads
 
Created
Source

Ember Version Is

Build Status npm version

A super simple set of helpers designed to give Ember Addon developers a clean way of supporting multiple Ember & Ember Data versions.

It's basically a thin wrapper on Semver.

Installation

# In your Addon...
npm install ember-version-is --save

Then in your Addon's index.js:

/* jshint node: true */
'use strict';

module.exports = {
  name: 'ember-infinity',

  /* Necessary Hack until Ember CLI supports nested addons. */
  included: function(app) {
    this.addons.forEach(function(addon){
      if (addon.name === "ember-version-is") {
        addon.included.apply(addon, [app]);
      }
    });
  }
};

Usage

Then anywhere in your codebase, you can do:

import Ember from 'ember';
import emberVersionIs from 'ember-version-is';
import { emberDataVersionIs } from 'ember-version-is';

export default Ember.Route.extend({
  model() {
    let promise;
    if (emberDataVersionIs('lessThanOrEqualTo', "1.13.0")) {
      promise = this.store.find('product', 1); 
    } else {
      promise = this.store.query('product', 1);
    }
    return promise.then(response => {
      if (emberVersionIs('equalTo', "2.0.0")) {
        Ember.warn("You are using Ember 2.0.  That is rad.");
      }
    });
  }
});

If you'd like to check arbitary versions of things, you can do that too:

import Ember from 'ember';
import { is } from 'ember-version-is';
const VERSION = '0.2.3';

export default Ember.Route.extend({
  activate() {
    if (is(VERSION, 'lessThanOrEqualTo', '0.2.5')) {
      this.set('techno', 'is making a comeback');
    }
  }
});

SemVer ranges are supported as well (works for is, emberVersionIs and emberDataVersionIs):

import Ember from 'ember';
import { is } from 'ember-version-is';
const VERSION = '0.2.8';

export default Ember.Route.extend({
  activate() {
    if (is(VERSION, '<= 0.2.5 || 0.2.8')) {
      this.set('techno', 'is making a comeback');
    }
  }
});

Keywords

FAQs

Package last updated on 30 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc