non-destructive-map-merge

1.0.0 • Public • Published

non-destructive-map-merge

A non-destructive-map-merge function for Sass

Credit: https://medium.com/@pentzzsolt/a-non-destructive-map-merge-function-for-sass-f91637f87b2e#.ekepo95qi

Example

$global-colors: (
    neutral: (
        x-light: #f1f1f1,
    ),
    primary: #df2,
    secondary: (
        base: (
            old: red,
            new: green
        )
    ),
    tertiary: (
        base: yellow
    )
);
 
$local-colors: (
    neutral: grey,
    primary: (
        light: #738bd3,
        base: #042f75
    ),
    secondary: (
        light: #ffa75b
    ),
    tertiary: (
        light: (
            first: orange,
            second: purple
        ),
    ),
    success: (
        base: #007b39
    )
);
 
$colors: non-destructive-map-merge($global-colors, $local-colors);
 
//Expected result: 
//$colors: ( 
// neutral: grey, 
// primary: ( 
// light: #738bd3, 
// base: #042f75 
// ), 
// secondary: ( 
// base: ( 
// old: red, 
// new: green 
// ), 
// light: #ffa75b 
// ), 
// tertiary: ( 
// base: yellow, 
// light: ( 
// first: orange, 
// second: purple 
// ) 
// ), 
// success: ( 
// base: #007b39 
// ) 
//); 

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i non-destructive-map-merge

      Weekly Downloads

      1

      Version

      1.0.0

      License

      ISC

      Last publish

      Collaborators

      • alexmeah