Created
May 5, 2019 04:48
-
-
Save chriskuech/8e213433bb9acb25cb9d7222ae1b4b77 to your computer and use it in GitHub Desktop.
This file contains 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
# names of the dimensions in the order that we take the cross product | |
$crossProductOrder = "Category1", "Category2", "Category3" | |
# get the object's identity vector, as member of the cross product | |
function Get-Vector([psobject] $obj) { | |
$crossProductOrder | % {$obj.$_} | |
} | |
# get the path to the object in the file system | |
function Get-VectorPath([psobject] $obj) { | |
(Get-Vector $obj) -join "/" | |
} | |
# get the values at the intersection of the sets defined by `$vector` | |
$vector = "category1value", "category2value", "category3value" | |
$vectorPath = "$container/$($vector -join "/").json" | |
Get-Content $vectorPath | ConvertTo-Json | |
# set the object | |
$obj | ConvertTo-Json | Out-File (Get-VectorPath $obj) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment