Giter Club home page Giter Club logo

alloy-open-source's Introduction

alloy-open-source's People

Contributors

alex avatar billylaing avatar jgarber623 avatar nick-alloy avatar paultag avatar scout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alloy-open-source's Issues

[GSuite Device Update Notifier] compareOSVersions always returns -1 if lengths don't match

iOS currently has the stable latest version (12.4.1) and some users have the beta (13.1).

If compareOSVersions will return -1 when comparing both 12.4.1 to 13.1 as well as 13.1 to 12.4.1. This means beta users are being caught as 'out of date'.

Because comparing versions is hard, and we're v1-centric, I added a kludge for myself:

function compareOSVersions(v1, v2) {
  if (v2.length > v1.length) {
    v1 = v1.concat(Array.apply(null, Array(v2.length - v1.length)).map(function(){return 0}))
  }
    
  // if (v1.length != v2.length) {
  //   return -1;
  // }
  
  for (var i = 0; i < v1.length; i++) {
    if (v1[i] < v2[i]) {
      return -1;
    } else if (v1[i] > v2[i]) {
      return 1;
    }
  }
  return 0;
}

While this is most absolutely not correct, this will give the right output in most cases I can think of in my pre-caffeinated Tuesday at 9:00 AM brain. I originally used new Array(v2.length - v1.length).fill(0), but realized Google Script isn't ECMAScript 6 yet. That can be massively simplified in the future.

Filling with 0 may also not be right. Maybe -1? If you get "out of bounds" it ought to have the current behavior, I think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.