Skip to content

2.14.0

Compare
Choose a tag to compare
@jonnitto jonnitto released this 29 Mar 14:20
· 13 commits to master since this release
5b5e776

Rename Carbon.String.merge to Carbon.String.classNames

Render all arguments as classNames and apply conditions if needed.
Merge strings and arrays to a string with unique values, separated by an empty space.

All arguments of the eel helper are evaluated and the following rules are applied:

  • falsy values: (null, '', [], {}) are not rendererd
  • array: all items that are scalar and truthy are rendered as classname
  • object: keys that have a truthy values are rendered as classname
  • scalar: is cast to string and rendered as class-name

Examples:

Expression Result
Carbon.String.classNames('', 'one') 'one'
Carbon.String.classNames(['one two three'], ['one', 'four']) 'one two three four'
Carbon.String.classNames(null, false, [null], {one: false}) null
Carbon.String.classNames('one two three', ['one', 'four']) 'one two three four'
Carbon.String.classNames('one', {two: true, three: false }) 'one two'

Return The merged string

Rename AlpineJS.xData to AlpineJS.function

Generate a function call for AlpineJS. More info.
Supports nested arrays. In named arrays ({first:1,second:null}) null get filtered out, but in list
arrays ([1,null]) and in plain values the will stay.

Examples:

Expression Result
AlpineJS.function('slider', {effect: 'slide', spaceBetween: 12, loop: true, navigation: null}) 'slider({effect:'slide',spaceBetween:12,loop:true})'
AlpineJS.function('slider', 'one', 1, false, null, ['string', 2, null]) 'slider('one',1,false,null,['string',2,null])'
AlpineJS.function("vote", 4) 'vote(4)'
  • name (string) The name for the function (e.g x-data, x-on:click, etc.)
  • ...arguments (mixed) The options for the function

Return The string for the x-data function call

Full Changelog: 2.13.0...2.14.0