2.5.17 • Published 9 months ago

@techor/one-liner v2.5.17

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Getting Started

npm install @techor/one-liner
import oneLiner from '@techor/one-liner';
// or
import { l } from '@techor/one-liner';

l is equal to l

Strings

l`a ${true && 'b'} c`;
// 'a b c'

Objects

l`a ${{ b: true, c: false, d: isTrue() }} e`;
// 'a b d e'

Arrays

l`a ${['b', 0, false, 'c']} d`;
// 'a b c d'

Resolve types

l`a ${true} ${false} ${''} ${null} ${undefined} ${0} ${NaN} b`
// 'a b'

Trim and clear

  • Remove newlines
  • Convert consecutive spaces to one space
l`
    a
    b
    ${undefined}
    c    d
`
// 'a b c d'

Mixed and nested

l`
    a
    ${
        [
            1 && 'b',
            { c: false, d: null },
            ['e', ['f']]
        ]
    }
    g    h
`;
// 'a b e f g h'

Execute like a function

l`a b ${['c', 'd']} ${{ e: true, f: false }} ${true && 'g'}`;
// or
line('a b', ['c', 'd'], { e: true, f: false }, true && 'g');

// 'a b c d e g'

Related

Inspiration

  • clsx - A tiny utility for constructing className strings conditionally
2.4.1

10 months ago

2.4.0

10 months ago

2.4.3

10 months ago

2.2.13

10 months ago

2.4.2

10 months ago

2.4.5

10 months ago

2.4.4

10 months ago

2.2.12

10 months ago

2.5.6

9 months ago

2.3.8

10 months ago

2.5.5

9 months ago

2.3.7

10 months ago

2.5.8

9 months ago

2.5.7

9 months ago

2.5.9

9 months ago

2.5.14

9 months ago

2.5.15

9 months ago

2.5.16

9 months ago

2.5.17

9 months ago

2.5.10

9 months ago

2.5.11

9 months ago

2.5.13

9 months ago

2.3.0

10 months ago

2.3.2

10 months ago

2.3.1

10 months ago

2.5.2

9 months ago

2.3.4

10 months ago

2.3.3

10 months ago

2.5.4

9 months ago

2.3.6

10 months ago

2.5.3

9 months ago

2.3.5

10 months ago

2.4.6

10 months ago

2.2.3

11 months ago

2.2.2

11 months ago

2.2.5

11 months ago

2.2.4

11 months ago

2.2.11

11 months ago

2.2.7

11 months ago

2.2.6

11 months ago

2.2.10

11 months ago

2.2.9

11 months ago

2.2.8

11 months ago

2.2.1

11 months ago

2.2.0

11 months ago

2.1.15

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago