How to use the dot-prop-immutable.set function in dot-prop-immutable

To help you get started, we’ve selected a few dot-prop-immutable 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 ealgis / ealgis / frontend / src / redux / modules / databrowser.tsx View on Github external
export default function reducer(state = initialState, action: IAction) {
    switch (action.type) {
        case START:
            state = dotProp.set(state, "active", true)
            state = dotProp.set(state, "tables", [])
            state = dotProp.set(state, "columns", [])
            state = dotProp.set(state, "selectedColumns", action.selectedColumns)
            state = dotProp.set(state, "component", action.component)
            state = dotProp.set(state, "config", { ...state.config, ...action.config })
            return dotProp.set(state, "message", action.message)
        case FINISH:
            return dotProp.set(state, "active", false)
        case ADD_TABLES:
            return dotProp.set(state, "tables", action.tables)
        case ADD_COLUMNS:
            return dotProp.set(state, "columns", action.columns)
        case SELECT_COLUMN:
            if (action.column) {
                const columns: Array = xorBy(
                    state.selectedColumns,
                    [action.column],
                    // @ts-ignore
                    (column: IColumn) => `${column.schema_name}.${column.id}`
github spaceuptech / automate-redux / index.js View on Github external
return (state = initialState, action) => {
    switch (action.type) {
      case "SET":
        return dotProp.set(state, action.path, action.value);

      case "RESET":
        // Reset the entire state
        if (action.path === undefined) {
          return initialState;
        }

        // Reset specific state
        return dotProp.set(
          state,
          action.path,
          dotProp.get(initialState, action.path)
        );

      case "PUSH":
        return dotProp.merge(state, action.path, [action.value]);
github eden-js / cli / lib / bundles / user / helpers / acl.js View on Github external
async validate (User, tests) {
    // Get list
    let obj  = {};
    let list = await this.list(User);

    // Check is array
    if (Array.isArray(list)) {
      // Set list
      for (let item of list) {
        // Set value
        obj = dotProp.set(obj, item, true);
      }
    }

    // Set array if not
    if (!Array.isArray(tests)) tests = [tests];

    // Find failed test
    return !(tests.filter((test) => {
      // Check if true/false
      if (test.toString() === 'true' && !User) return true;
      if (test.toString() === 'false' && User) return true;

      // Check list
      if (list === true) return false;

      // Loop props
github spaceuptech / automate-redux / index.js View on Github external
return (state = initialState, action) => {
    switch (action.type) {
      case "SET":
        return dotProp.set(state, action.path, action.value);

      case "RESET":
        // Reset the entire state
        if (action.path === undefined) {
          return initialState;
        }

        // Reset specific state
        return dotProp.set(
          state,
          action.path,
          dotProp.get(initialState, action.path)
        );

      case "PUSH":
        return dotProp.merge(state, action.path, [action.value]);

      case "INCREMENT":
        var initialValue = Number(dotProp.get(state, action.path, 0))
        var newValue = initialValue + action.value
        return dotProp.set(state, action.path, newValue)

      case "DECREMENT":
          var initialValue = Number(dotProp.get(state, action.path, 0))
          var newValue = initialValue - action.value
github ealgis / ealgis / frontend / src / redux / modules / snackbars.tsx View on Github external
state.messages.push(action.message!)
            return dotProp.set(state, `messages`, state.messages)
        case START:
            if (state.open === false && state.messages.length > 0) {
                // Pop the first message off the front of the queue
                const message = state.messages.shift()
                state = dotProp.set(state, `messages`, state.messages)
                state = dotProp.set(state, `active`, message)
                state = dotProp.set(state, `open`, true)
            }
            return state
        case NEXT:
            if (state.messages.length > 0) {
                // Pop the first message off the front of the queue
                const message = state.messages.shift()
                state = dotProp.set(state, `messages`, state.messages)
                state = dotProp.set(state, `active`, message)
                return dotProp.set(state, `open`, true)
            } else {
                state = dotProp.set(state, `active`, { message: "" })
                return dotProp.set(state, `open`, false)
            }
        default:
            return state
    }
}
github taskcluster / taskcluster / ui / src / views / Tasks / TaskIndex / IndexedTask / index.jsx View on Github external
return dotProp.set(previousResult, 'latestArtifacts', artifacts =>
          dotProp.set(
            dotProp.set(artifacts, 'edges', edges),
            'pageInfo',
            pageInfo
          )
        );
github ealgis / ealgis / frontend / src / redux / modules / ealgis.tsx View on Github external
export default function reducer(state = initialState, action: IAction) {
    switch (action.type) {
        case LOAD_USER:
            return dotProp.set(state, "user", action.user)
        case LOAD_RECENT_TABLES:
            return dotProp.set(state, "user.recent_tables", action.recent_tables)
        case LOAD_FAVOURITE_TABLES:
            return dotProp.set(state, "user.favourite_tables", action.favourite_tables)
        case LOAD_GEOM:
            return dotProp.set(state, "geominfo", action.geominfo)
        case LOAD_COLOUR_DEFS:
            return dotProp.set(state, "colourdefs", action.colourdefs)
        case LOAD_COLOURS:
            return dotProp.set(state, "colourinfo", action.colourinfo)
        case LOAD_TABLES:
            return dotProp.set(state, "tableinfo", { ...state.tableinfo, ...action.tableinfo })
        case LOAD_TABLE:
            return dotProp.set(state, `tableinfo.${action.schema}.${action.table.id}.`, action.table)
        case LOAD_SCHEMAS:
            return dotProp.set(state, "schemainfo", action.schemainfo)
github webiny / webiny-js / packages / app-page-builder / src / editor / plugins / elements / row / RowContainer.js View on Github external
{elements.map((childElement, index) => {
                const last = index === elements.length - 1;
                let leftElement = index > 0 && elements[index - 1];
                if (resizing) {
                    if (resizing.left.id === childElement.id) {
                        childElement = set(childElement, "data.width", width.left);
                    }

                    if (resizing.right.id === childElement.id) {
                        childElement = set(childElement, "data.width", width.right);
                        leftElement = set(leftElement, "data.width", width.left);
                    }
                }

                return (
github ealgis / ealgis / frontend / src / redux / modules / layerform.tsx View on Github external
export default function reducer(state = initialState, action: IAction) {
    switch (action.type) {
        case LOAD_CHIPS:
            return dotProp.set(state, "chips", action.chips)
        default:
            return state
    }
}
github taskcluster / taskcluster / src / views / CachePurges / ViewCachePurges / index.jsx View on Github external
updateQuery(previousResult, { fetchMoreResult }) {
        const { edges, pageInfo } = fetchMoreResult.cachePurges;

        if (!edges.length) {
          return previousResult;
        }

        return dotProp.set(previousResult, 'cachePurges', cachePurges =>
          dotProp.set(
            dotProp.set(cachePurges, 'edges', edges),
            'pageInfo',
            pageInfo
          )
        );
      },
    });

dot-prop-immutable

Immutable version of dot-prop with some extensions

MIT
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis