Giter Site home page Giter Site logo

aspect-ratio's Introduction

aspect-ratio's People

Contributors

andreivinaga avatar chrisspiegl avatar dependabot-preview[bot] avatar dependabot[bot] avatar kikobeats avatar michaelwclark avatar trevorblades avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aspect-ratio's Issues

CLI support

Hi,

I'm currently writing an article on fluid images involving some aspect ratio computations.
Would it be possible to add cli support so I can cite your module?

Something like this:

aspect-ratio 1920 1080
# => 16:9
aspect-ratio 1920 1080 --separator=/
# => 16/9

Thanks!

An in-range update of mocha is breaking the build 🚨

Version 3.4.0 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v3.4.0

Mocha is now moving to a quicker release schedule: when non-breaking changes are merged, a release should happen that week.

This week's highlights:

  • allowUncaught added to commandline as --allow-uncaught (and bugfixed)
  • warning-related Node flags

🎉 Enhancements

🐛 Fixes

🔩 Other

Commits

The new version differs by 9 commits0.

  • 7554b31 Add Changelog for v3.4.0
  • 9f7f7ed Add --trace-warnings flag
  • 92561c8 Add --no-warnings flag
  • ceee976 lint test/integration/fixtures/simple-reporter.js
  • dcfc094 Revert "use semistandard directly"
  • 93392dd no special case for macOS running Karma locally
  • 4d1d91d --allow-uncaught cli option
  • fb1e083 fix allowUncaught in browser
  • 4ed3fc5 Add license report and scan status

false

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Why force highest to be first in output?

Hello, I just found this to calculate the aspect ratio of images to makes sure a suer selects a 16x9 or a 9x16 for upload.

However, I noticed that this library always puts whatever is the heigher value as the first in the output?

Aka:

160x90 => 16:9
90x160 => 16:9

Which is not correct and isn't very useful? Why not keep the order on the final output? Is there a reason that I am not aware of?

I understand it may be necessary for the gcd calculation, but not for the final output. I think there it makes more sense to use the initial height/width as they were input.

An in-range update of mocha is breaking the build 🚨

Version 4.0.0 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.5.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v4.0.0

4.0.0 / 2017-10-02

You might want to read this before filing a new bug! 😝

💥 Breaking Changes

For more info, please read this article.

Compatibility

  • #3016: Drop support for unmaintained versions of Node.js (@boneskull):
    • 0.10.x
    • 0.11.x
    • 0.12.x
    • iojs (any)
    • 5.x.x
  • #2979: Drop support for non-ES5-compliant browsers (@boneskull):
    • IE7
    • IE8
    • PhantomJS 1.x
  • #2615: Drop Bower support; old versions (3.x, etc.) will remain available (@ScottFreeCode, @boneskull)

Default Behavior

  • #2879: By default, Mocha will no longer force the process to exit once all tests complete. This means any test code (or code under test) which would normally prevent node from exiting will do so when run in Mocha. Supply the --exit flag to revert to pre-v4.0.0 behavior (@ScottFreeCode, @boneskull)

Reporter Output

👎 Deprecations

  • #2493: The --compilers command-line option is now soft-deprecated and will emit a warning on STDERR. Read this for more info and workarounds (@ScottFreeCode, @boneskull)

🎉 Enhancements

  • #2628: Allow override of default test suite name in XUnit reporter (@ngeor)

📖 Documentation

🔩 Other

Commits

The new version differs by 48 commits.

  • d69bf14 Release v4.0.0
  • 171b9f9 pfix "prepublishOnly" potential portability problem
  • 60e39d9 Update link to wiki (GitHub at the leading --)
  • 804f9d5 Update link because GitHub ate the leading --
  • 3326c23 update CHANGELOG for v4.0.0 [ci skip]
  • 6dd9252 add link to wiki on --compilers deprecation
  • 96318e1 Deprecate --compilers
  • 92beda9 drop bower support
  • 58a4c6a remove unused .npmignore
  • 7af6611 kill Date#toISOString shim
  • 43501a2 reduce noise about slow tests; make a few tests faster, etc.
  • fa228e9 update --exit / --no-exit integration test for new default behavior
  • 3fdd3ff Switch default from forced exit to no-exit
  • c5d69e0 add integration tests for --exit/--no-exit
  • 3a7f8dc enhance runMochaJSON() helper by returning the subprocess instance

There are 48 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

Npm Install issue

I tryed install this package using npm, but don't works.

I get this error:

$ npm install aspect-ratio --save
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "aspect-ratio" under a package
npm ERR! also called "aspect-ratio". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR!     <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2020-05-14T22_10_04_519Z-debug.log

Node Version: v12.16.1
NPM Version: 6.13.4

An in-range update of mocha is breaking the build 🚨

Version 4.0.1 of mocha was just published.

Branch Build failing 🚨
Dependency mocha
Current Version 4.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v4.0.1

4.0.1 / 2017-10-05

🐛 Fixes

Commits

The new version differs by 6 commits.

  • eb8bf8d Release v4.0.1
  • 3b485ea update CHANGELOG.md for v4.0.1 [ci skip]
  • 96e5c1a upgrade eslint to v4.8.0
  • d7cff37 Update growl to 1.10.3
  • 0cdd921 remove preversion script; test on publish; closes #2999
  • f49c0ce Fix changelog issues/pr URLs (#3047)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Cannot find module 'aspect-ratio'

When I npm install --save aspect-ratio, the module at index.js doesn't show up. This is reproducible at https://npm.runkit.com/aspect-ratio. Without event writing any code and hitting "run" you'll see that it can't resolve the aspect-ratio module.

I looked at your .npmignore file and can't find anything suspicious but I can't imagine why your root file isn't being installed.

Cleanup & optimize code suggestion.

aspect-ratio/index.js

Lines 11 to 15 in 99b798d

if (numerator < denominator) {
temp = numerator
numerator = denominator
denominator = temp
}

Have been digging around trying to solve aspect ratio stuff on my end. Reading your code i noticed a few spots you could clean up. Not sure if this will require a transpile or anything, but just thought i'd share my 2 cents.

const gcd = (a, b) => b === 0 ? a : gcd(b, a % b)
const aspectRatio = (height, width, seperator=':')=> {
  const [h1, w1] = height < width ? [width, height] : [height, width]
  // or...
  // const [h1, w1] = [Math.max(numerator, denominator), Math.min(numerator, denominator)]

  const divisor = gcd(h1, w1)
  return `${h1/divisor}${seperator}${w1/divisor}`
}

This removes any let variables and gets rid of a bit of code for you. Also there is no mutation of the input variables (which is always a no-no). Feel free to use this or not, literally no change in behavior, just wanted to help a fellow open source author possibly learn another way to do things.

Can't be used by browsers in production

When I run a production build using webpack and UglifyJS, I get this error:

ERROR in main.613c420722787f3c86d7.js from UglifyJs
    Unexpected token: operator (>) [./node_modules/aspect-ratio/index.js:6,0][main.613c420722787f3c86d7.js:116556,27]

😭

This is due to the fact that we're using arrow functions and UglifyJS is expecting plain old JavaScript. This means that we should be transpiling a browser version of this library to be used in these scenarios.

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.