diff --git a/docs/boolean-to-inList.md b/docs/boolean-to-inList.md index bdc49d3..3327e50 100644 --- a/docs/boolean-to-inList.md +++ b/docs/boolean-to-inList.md @@ -23,26 +23,28 @@ When the setter is called, if the new value is truthy then the item will be adde Use this converter when two-way binding to an element with a boolean attribute, such as a checkbox. ```js -var map = new DefineMap({ +const map = new DefineMap( { item: 5, - list: [1, 2, 3, 4, 5] -}); + list: [ 1, 2, 3, 4, 5 ] +} ); -var template = stache(''); +const template = stache( + "" +); -document.body.appendChild(template(map)); +document.body.appendChild( template( map ) ); -var input = document.querySelector('input[type=checkbox]'); +const input = document.querySelector( "input[type=checkbox]" ); -console.log(input.checked); // -> true +console.log( input.checked ); // -> true map.item = 6; -console.log(input.checked); // -> false +console.log( input.checked ); // -> false -map.list.push(6); +map.list.push( 6 ); -console.log(input.checked); // -> true +console.log( input.checked ); // -> true ``` @demo demos/can-stache-converters/input-checkbox.html diff --git a/docs/either-or.md b/docs/either-or.md index ec0afeb..a759c0d 100644 --- a/docs/either-or.md +++ b/docs/either-or.md @@ -41,13 +41,13 @@ You pass 3 arguments to this [can-stache.registerConverter converter]. The first ``` ```js -var template = stache.from("demo-template"); +const template = stache.from( "demo-template" ); -var fan = new DefineMap({ +const fan = new DefineMap( { pref: "Star Trek" -}); +} ); -document.body.appendChild(template(fan)); +document.body.appendChild( template( fan ) ); // User unchecks the checkbox fan.pref === "Star Wars"; diff --git a/docs/equal.md b/docs/equal.md index 3e15900..2a963ed 100644 --- a/docs/equal.md +++ b/docs/equal.md @@ -52,19 +52,19 @@ In this example we are using objects, to select a captain from one of three play ``` ```js -var template = stache.from("demo"); -var vm = new DefineMap({ +const template = stache.from( "demo" ); +const vm = new DefineMap( { captain: null, players: [ { name: "Matthew" }, { name: "Wilbur" }, { name: "Anne" } ] -}); -vm.captain = vm.players[0]; +} ); +vm.captain = vm.players[ 0 ]; -var frag = template(vm); -document.body.appendChild(frag); +const frag = template( vm ); +document.body.appendChild( frag ); ``` @demo demos/can-stache-converters/input-radio.html diff --git a/docs/input-radio.md b/docs/input-radio.md index 182d54e..d53a866 100644 --- a/docs/input-radio.md +++ b/docs/input-radio.md @@ -15,13 +15,13 @@ To bind to a radio input, if you have a set of boolean values you can bind to th ``` ```js -var template = stache.from("demo"); -var map = new DefineMap({ +const template = stache.from( "demo" ); +const map = new DefineMap( { one: true, two: false -}); +} ); -document.body.appendChild(template(map)); +document.body.appendChild( template( map ) ); ``` ## Binding to a selected value diff --git a/docs/not.md b/docs/not.md index 51ce442..f485d14 100644 --- a/docs/not.md +++ b/docs/not.md @@ -28,13 +28,13 @@ Use this converter to two-way bind to the negation of some value. For example: ``` ```js -var map = new DefineMap({ +const map = new DefineMap( { val: true -}); +} ); -document.body.appendChild(template(map)); +document.body.appendChild( template( map ) ); -var input = document.querySelector('input'); +const input = document.querySelector( "input" ); input.checked; // -> false @@ -55,13 +55,13 @@ map.val === true; // because the checkbox is now false. ``` ```js -var map = new DefineMap({ +const map = new DefineMap( { item: 2, - list: new DefineList([ 1, 2, 3 ]) -}); + list: new DefineList( [ 1, 2, 3 ] ) +} ); -document.body.appendChild(template(map)); -var input = document.querySelector('input'); +document.body.appendChild( template( map ) ); +const input = document.querySelector( "input" ); input.checked; // -> false @@ -74,10 +74,10 @@ input.checked; // -> true // Check the input, whick will set its value to `false` // This will be converted to `true` by not() and pushed into the list -map.list.indexOf(4); // -> 3 +map.list.indexOf( 4 ); // -> 3 // Remove it from the list, which will be converted to true by not() -map.list.splice(3, 1); +map.list.splice( 3, 1 ); input.checked; // -> true ``` diff --git a/docs/string-to-any.md b/docs/string-to-any.md index cefb704..c0a80f7 100644 --- a/docs/string-to-any.md +++ b/docs/string-to-any.md @@ -36,14 +36,14 @@ This is usually used with `