Skip to content

Instantly share code, notes, and snippets.

@jheidepriem
Forked from kaylagordon/crafting.md
Created December 8, 2022 19:18
Show Gist options
  • Select an option

  • Save jheidepriem/bbbc85dbaf76c78d0062cb96135d12d3 to your computer and use it in GitHub Desktop.

Select an option

Save jheidepriem/bbbc85dbaf76c78d0062cb96135d12d3 to your computer and use it in GitHub Desktop.

Revisions

  1. @kaylagordon kaylagordon revised this gist Apr 14, 2022. 1 changed file with 57 additions and 5 deletions.
    62 changes: 57 additions & 5 deletions crafting.md
    Original file line number Diff line number Diff line change
    @@ -1,26 +1,78 @@
    #
    # Crafting

    ```js

    const craftSupplies = {
    crossStitching: [
    { name: 'fabric', amountNeeded: 0.25 },
    { name: 'needle', amountNeeded: 1 },
    { name: 'thread', amountNeeded: 10 },
    { name: 'scissors', amountNeeded: 1 },
    { name: 'hoop', amountNeeded: 1 }
    ],
    weaving: [
    { name: 'loom', amountNeeded: 1 },
    { name: 'needle', amountNeeded: 1 },
    { name: 'yarn', amountNeeded: 6 },
    { name: 'scissors', amountNeeded: 1 }
    ],
    knitting: [
    { name: 'needle', amountNeeded: 2 },
    { name: 'yarn', amountNeeded: 4 },
    { name: 'scissors', amountNeeded: 1 }
    ],
    crocheting: [
    { name: 'hook', amountNeeded: 1 },
    { name: 'yarn', amountNeeded: 3 },
    { name: 'scissors', amountNeeded: 1 }
    ]
    };
    ```

    ## Level One
    Write a function that takes in a parameter of craft and returns a list of supplies needed


    ```js
    getSupplyList('crossStitching')
    // --> ['fabric', 'needle', 'thread', 'scissors', hoop]

    getSupplyList('crocheting')
    // --> ['hook', 'yarn', 'scissors']
    ```

    ## Level Two

    Write a function that returns a list of supplies with associated crafts

    ```js

    viewSupplies()
    // -->
    // {
    // fabric: ['crossStitching'],
    // needle: ['crossStitching', 'weaving', 'knitting'],
    // thread: ['crossStitching'],
    // scissors: ['crossStitching', 'weaving', 'knitting', 'crocheting'],
    // hoop: ['crossStitching'],
    // loom: ['weaving'],
    // yarn: ['weaving', 'knitting', 'crocheting']
    // hook: ['crocheting']
    // }
    ````

    ## Level Three
    Refactor your viewSupplies function to include the total amount needed for each supply


    ```js
    viewSupplies()
    // -->
    // {
    // fabric: { crafts: ['crossStitching'], amountNeeded: 0.25 },
    // needle: { crafts: ['crossStitching', 'weaving', 'knitting'], amountNeeded: 0.25 },
    // thread: { crafts: ['crossStitching'], amountNeeded: 4 },
    // scissors: { crafts: ['crossStitching', 'weaving', 'knitting', 'crocheting'], amountNeeded: 4 },
    // hoop: { crafts: ['crossStitching'], amountNeeded: 1 },
    // loom: { crafts: ['weaving'], amountNeeded: 1 },
    // yarn: { crafts: ['weaving', 'knitting', 'crocheting'] amountNeeded: 13 },
    // hook: { crafts: ['crocheting'], amountNeeded: 1 },
    // }
    ```
  2. @kaylagordon kaylagordon created this gist Apr 14, 2022.
    26 changes: 26 additions & 0 deletions crafting.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #

    ```js

    ```

    ## Level One


    ```js

    ```

    ## Level Two


    ```js

    ````

    ## Level Three


    ```js
    ```