Skip to content

Commit

Permalink
fix: handle NaN in spring
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Nov 21, 2021
1 parent 8a69dc6 commit c4d2849
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
32 changes: 16 additions & 16 deletions examples/simple/.rescriptsrc.js
@@ -1,29 +1,29 @@
const path = require('path')
const resolveFrom = require('resolve-from')
const path = require("path");
const resolveFrom = require("resolve-from");

const fixLinkedDependencies = config => {
const fixLinkedDependencies = (config) => {
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
react$: resolveFrom(path.resolve('node_modules'), 'react'),
'react-dom$': resolveFrom(path.resolve('node_modules'), 'react-dom'),
react$: resolveFrom(path.resolve("node_modules"), "react"),
"react-dom$": resolveFrom(path.resolve("node_modules"), "react-dom"),
},
}
return config
}
};
return config;
};

const includeSrcDirectory = config => {
const includeSrcDirectory = (config) => {
config.resolve = {
...config.resolve,
modules: [path.resolve('src'), ...config.resolve.modules],
}
return config
}
modules: [path.resolve("src"), ...config.resolve.modules],
};
return config;
};

module.exports = [
['use-babel-config', '.babelrc'],
['use-eslint-config', '.eslintrc'],
["use-babel-config", ".babelrc"],
["use-eslint-config", ".eslintrc"],
fixLinkedDependencies,
// includeSrcDirectory,
]
];
Binary file modified media/logo.sketch
Binary file not shown.
3 changes: 3 additions & 0 deletions src/utils/spring.ts
Expand Up @@ -13,6 +13,9 @@ type Solution = {
const epsilon = 0.001

function almostEqual(a: number, b: number) {
if (Number.isNaN(a) && Number.isNaN(b)) {
return true
}
return a > b - epsilon && a < b + epsilon
}

Expand Down

0 comments on commit c4d2849

Please sign in to comment.