File: 94Template.cxx.styled

package info (click to toggle)
codequery 1.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,860 kB
  • sloc: cpp: 151,420; xml: 16,576; python: 5,602; ansic: 5,487; makefile: 559; perl: 496; ruby: 209; sql: 194; sh: 106; php: 53; vhdl: 51; erlang: 47; objc: 22; lisp: 18; cobol: 18; modula3: 17; asm: 14; fortran: 12; ml: 11; tcl: 6
file content (31 lines) | stat: -rw-r--r-- 1,379 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{2}// Test JavaScript template expressions for issue 94
{0}
{2}// Basic
{5}var{0} {11}basic{0} {10}={0} {20}`{10}${{11}identifier{10}}{20}`{10};{0}

{2}// Nested
{5}var{0} {11}nested{0} {10}={0} {20}` {10}${{0} {20}` {10}${{0} {4}1{0} {10}}{20} `{0} {10}}{20} `{10};{0}

{2}// With escapes
{5}var{0} {11}xxx{0} {10}={0} {10}{{0}
    {7}'1'{10}:{0} {20}`{27}\`\u0020\${20}{a{10}${{4}1{0} {10}+{0} {4}1{10}}{20}b}`{10},{0}
    {7}'2'{10}:{0} {20}`{27}\${20}{a{10}${{0} {20}`b{10}${{4}1{0} {10}+{0} {4}2{10}}{20}c`{10}.{16}charCodeAt{10}({4}2{10}){0} {10}}{20}d}`{10},{0}
    {7}'3'{10}:{0} {20}`{27}\${20}{a{10}${{0} {20}`b{10}${{0} {20}`c{10}${{0} {19}JSON{10}.{16}stringify{10}({{0}
        {7}'4'{10}:{0} {10}{},{0}
        {10}}){0} {10}}{20}d`{0} {10}}{20}e`{0} {10}}{20}f}`{10},{0}
{10}};{0}

{2}// Original request
{11}fetchOptions{10}.{11}body{0} {10}={0} {20}`
{
	"accountNumber" : "248796",
	"customerType" : "Shipper",
	"destinationCity" : "{10}${{11}order{10}.{11}destination{10}.{11}city{10}}{20}",
	"destinationState" : "{10}${{11}order{10}.{11}destination{10}.{11}stateProvince{10}}{20}",
	"destinationZip" : {10}${{11}order{10}.{11}destination{10}.{11}postalCode{10}}{20},
	"paymentType" : "Prepaid",
	"shipmentInfo" :
	{
		"items" : [ { "shipmentClass" : "50", "shipmentWeight" : "{10}${{11}order{10}.{11}totalWeight{10}.{11}toString{10}()}{20}" } ]
	}
}`{10};{0}