Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Replace runtime `typeof` checks and ad-hoc empty-string checks with `lodash-es` predicates.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | 37% | 0% |
| case-01 | ✗→✓ | ▲ Improved | -7% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -11% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -32% | 0% |
Replace runtime typeof checks and ad-hoc empty-string checks with lodash-es predicates.
typeof value === 'string'.value && typeof value === 'object'.value.trim() !== '' or value.trim() === ''.typeof (TypeScript only), for example:ReturnType<typeof fn>keyof typeof CONST_MAPz.infer<typeof Schema>These are compile-time types and must remain as-is.
typeof x === 'string' -> isString(x)typeof x !== 'string' -> !isString(x)typeof x === 'number' -> isNumber(x)typeof x === 'boolean' -> isBoolean(x)typeof x === 'function' -> isFunction(x)typeof x === 'undefined' -> isUndefined(x)x && typeof x === 'object' -> isObjectLike(x)typeof x === 'object' && x !== null -> isObjectLike(x)typeof x === 'object' && !Array.isArray(x) -> isObjectLike(x) && !isArray(x)isEmpty(value.trim())value.trim() === ''value.trim() !== ''value.trim().length === 0lodash-es:tsimport { isString, isNumber, isObjectLike, isEmpty } from 'lodash-es';
bashrg -n "typeof\s+[^\n]+(?:===|!==)\s*'" src
typeof remains:bashrg -n "\btypeof\b" src
bashnpm run type-check
Other measured skills in the registry, with their headline benchmark lift.