Fix typos (#670)
This commit is contained in:
parent
aa06bb5ac3
commit
5bbc12979d
1 changed files with 17 additions and 9 deletions
|
|
@ -152,7 +152,15 @@ const createStyler = (open, close, parent) => {
|
||||||
const createBuilder = (self, _styler, _isEmpty) => {
|
const createBuilder = (self, _styler, _isEmpty) => {
|
||||||
// Single argument is hot path, implicit coercion is faster than anything
|
// Single argument is hot path, implicit coercion is faster than anything
|
||||||
// eslint-disable-next-line no-implicit-coercion
|
// eslint-disable-next-line no-implicit-coercion
|
||||||
const builder = (...arguments_) => applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
const builder = (...arguments_) => applyStyle(builder,
|
||||||
|
// Fast path for common 2 argument
|
||||||
|
// Using `== null` to handle both null and undefined
|
||||||
|
// and using String() for other values to preserve toString() coercion
|
||||||
|
(arguments_.length === 1) ? ('' + arguments_[0]) : (arguments_.length === 2) ? (
|
||||||
|
(arguments_[0] == null ? '' : String(arguments_[0])) + ' ' +
|
||||||
|
(arguments_[1] == null ? '' : String(arguments_[1]))
|
||||||
|
) : arguments_.join(' ')
|
||||||
|
);
|
||||||
|
|
||||||
// We alter the prototype because we must return a function, but there is
|
// We alter the prototype because we must return a function, but there is
|
||||||
// no way to create a function with a different prototype
|
// no way to create a function with a different prototype
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue