How to use dset - 2 common examples

To help you get started, we’ve selected a few dset examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mrmartineau / design-system-utils / src / index.ts View on Github external
public set(location: string, value: any): void {
    return set(this.ds, location, value)
  }
github bradlc / babel-plugin-tailwind-components / src / getStyles.js View on Github external
...a,
                [c]:
                  '__computed__' +
                  pre +
                  state.tailwindConfigIdentifier.name +
                  '.theme.' +
                  dynamicStyles[prefix].config +
                  '["' +
                  key +
                  '"]'
              }
        }, {})
      }

      if (modifiers.length) {
        dset(acc, modifiers, { ...dlv(acc, modifiers, {}), ...obj })
        return acc
      } else {
        return { ...acc, ...obj }
      }
    } else {
      throw new Error(`Couldn’t resolve Tailwind class name: ${className}`)
    }
  }, {})

dset

A tiny (194B) utility for safely writing deep Object values~!

MIT
Latest version published 6 months ago

Package Health Score

76 / 100
Full package analysis

Popular dset functions