diff --git a/src/__tests__/index.js b/src/__tests__/index.js index d6baba4..cb8321a 100644 --- a/src/__tests__/index.js +++ b/src/__tests__/index.js @@ -204,6 +204,12 @@ test( '2px' ) +test( + 'should not match "calc" in another function signature', + testFixture, + '-calc(1px + 1px)', +) + test( 'should discard zero values (#2) (1)', testFixture, diff --git a/src/index.js b/src/index.js index d2de067..67f2280 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ import { parser } from './parser' // eslint-disable-line import reducer from './lib/reducer' import stringifier from './lib/stringifier' -const MATCH_CALC = /((?:\-[a-z]+\-)?calc)/ +const MATCH_CALC = /^((?:\-[a-z]+\-)?calc)$/ export default (value, precision = 5) => { return valueParser(value).walk(node => {