This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let | |
| Value.FixType = (value, optional depth) => | |
| let | |
| nextDepth = if depth = null then 3 else depth - 1, | |
| result = if depth = 0 then null | |
| else if value is type then TextType(value) | |
| else if value is table then Table.TransformColumns(value, {}, @Value.FixType) | |
| else if value is list then List.Transform(value, each @Value.FixType(_, nextDepth)) | |
| else if value is record then | |
| Record.FromList(List.Transform(Record.ToList(value), each @Value.FixType(_, nextDepth)), Record.FieldNames(value)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let | |
| Value.FixType = (value, optional depth) => | |
| let | |
| nextDepth = if depth = null then 3 else depth - 1, | |
| result = if depth = 0 then null | |
| else if value is type then TextType(value) | |
| else if value is table then Table.TransformColumns(value, {}, @Value.FixType) | |
| else if value is list then List.Transform(value, each @Value.FixType(_, nextDepth)) | |
| else if value is record then | |
| Record.FromList(List.Transform(Record.ToList(value), each @Value.FixType(_, nextDepth)), Record.FieldNames(value)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let | |
| EnforceTypes = (table as table, schema as table) as table => | |
| let | |
| map = (t) => if t = type list or t = type record or t = type any then null else t, | |
| mapped = Table.TransformColumns(schema, {"Value", map}), | |
| omitted = Table.SelectRows(mapped, each [Value] <> null), | |
| transforms = Table.ToRows(omitted), | |
| changedType = Table.TransformColumnTypes(table, transforms) | |
| in | |
| changedType, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Converts files to the given encoding. | |
| Matches the include pattern recursively under the given path. | |
| .EXAMPLE | |
| Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8 | |
| #> | |
| function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') { | |
| $count = 0 |