Literals

JavaScript pattern

Utility patterns for matching literals.


Apply with the Grit CLI
grit apply util_literal

Matches all kinds of literals

BEFORE
console.log('This message is different');
console.log('93');
console.log(93);
console.log(true);

// Objects are not matched:
console.log({
  name: 'John Doe',
  value: 93,
  age: 42,
});
AFTER
console.log('This message is different');
console.log(42);
console.log(42);
console.log(true);

// Objects are not matched:
console.log({
  name: 'John Doe',
  value: 42,
  age: 42,
});