JSPM

unsafe-set

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q14817F
    • License ISC

    set value at property, create intermediate properties if necessary, clobbering anything in it's way

    Package Exports

    • unsafe-set

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (unsafe-set) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    unsafe-set

    Unsafely set a value at a property, creating intermediate properties if necessary. If one doesn't exist, or exists but isn't an object, it will become an object. Does not support intermediate arrays like lodash.set. Returns the original, modified object.

    • tiny
    • no dependencies
    import set from 'unsafe-set';
    
    let obj = {
      a: 'foo'
    }
    
    set(obj, 'a.aa.aaa', 'bar');
    
    //{a: {aa: {aaa: 'bar'}}}