Skip to content

Commit

Permalink
Remove regex from importantify
Browse files Browse the repository at this point in the history
Now that this has been sufficiently simplified, we can easily remove the
regex entirely.
  • Loading branch information
lencioni committed Mar 6, 2017
1 parent 6d4d566 commit ea2cc4b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ function murmurhash2_32_gc(str) {
export const hashObject = (object /* : ObjectMap */) /* : string */ => murmurhash2_32_gc(JSON.stringify(object));


const IMPORTANT_RE = /(?: !important)?$/;

// Given a single style value string like the "b" from "a: b;", adds !important
// to generate "b !important".
export const importantify = (string /* : string */) /* : string */ =>
string.replace(IMPORTANT_RE, " !important");
(string.slice(-11) !== ' !important')
? `${string} !important`
: string;

0 comments on commit ea2cc4b

Please sign in to comment.