Giter Club home page Giter Club logo

obj-traverse's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

obj-traverse's Issues

Love the demo

I've written a somewhat similar library to this one, called object-scan. I actually believe that object-scan would be well suited for powering this library, but I'm digressing...

Your demo looks really cool and I'm planning to do something similar. Ideally I would want to make the result editable at the same time as displaying it. Just wondering if you have some suggestions. Currently looking at Draft.js and it looks promising.

'findFirst' is not exported by node_modules/obj-traverse/lib/obj-traverse.js

I can't import any of the methods of the library. Not sure why. I am using Rollup instead of Webpack if that matters, as I noticed you have webpack code in the repo.

Here is the error from my server console:

'findFirst' is not exported by node_modules/obj-traverse/lib/obj-traverse.js, imported by src/node_modules/@sv/stores/manifest.js
...
4: import { findFirst } from 'obj-traverse/lib/obj-traverse'
            ^

This package can't be installed on Heroku

UPD: This issue was invalid at the time it was created and not relevant, please ignore

Here is log:

module.js:549 
    throw err; 
    ^ 
Error: Cannot find module 'obj-traverse' 
    at Function.Module._resolveFilename (module.js:547:15) 
    at Function.Module._load (module.js:474:25) 
    at Module.require (module.js:596:17) 
    at require (internal/module.js:11:18) 
    at Object.<anonymous> (/app/index.js:10:20) 
    at Module._compile (module.js:652:30) 
    at Object.Module._extensions..js (module.js:663:10) 
    at Module.load (module.js:565:32) 
    at tryModuleLoad (module.js:505:12) 
    at Function.Module._load (module.js:497:3) 
    at Function.Module.runMain (module.js:693:10) 
    at startup (bootstrap_node.js:191:16) 
    at bootstrap_node.js:612:3 

Can you help me with this?

Add Custom test data to the demo

It's really nice that we can play with library without taking to the local environment.
Can you enhance the demo to add custom test data?

Value of Child in modify cannot be null

I've run into an issue where if the value of my child is null, then an exception is thrown.

var tree = JSON.parse('{
  "groupId": 1,
  "displayName": "RootName",
  "children": [
    {
      "groupId": 22,
      "displayName": "Child Group 22",
      "children": null,  <-----------EXISTS BUT IS NULL
      "hasChildren": true,
      "groupType": "Organization",
      "accessType": "Restricted"
    },
    {
      "groupId": 9,
      "displayName": "Child Group 9",
      "children": null,<-----------EXISTS BUT IS NULL
      "hasChildren": true,
      "groupType": "Organization",
      "accessType": "Restricted"
    }
  ],
  "hasChildren": false,
  "groupType": "Organization",
  "accessType": "Restricted"
}');

var newChildrenArray = JSON.parse('{
  "groups": [
    {
      "groupId": 23,
      "displayName": "Child of Child Group 22",
      "children": null,
      "hasChildren": false,
      "groupType": "Organization",
      "accessType": "Restricted"
    }
  ]
}');
var parentId = 22;

Then executing as:

findAndModifyFirst(tree, "children", { groupdId: parentId }, { children: newChildrenArray["groups"] })

I would expect it to modify the tree to:

'{
  "groupId": 1,
  "displayName": "RootName",
  "children": [
    {
      "groupId": 22,
      "displayName": "Child Group 22",
      "children":  [
          {
            "groupId": 23,
            "displayName": "Child of Child Group 22",
            "children": null,
            "hasChildren": false,
            "groupType": "Organization",
            "accessType": "Restricted"
          }],
      "hasChildren": true,
      "groupType": "Organization",
      "accessType": "Restricted"
    },
    {
      "groupId": 9,
      "displayName": "Child Group 9",
      "children": null,
      "hasChildren": true,
      "groupType": "Organization",
      "accessType": "Restricted"
    }
  ],
  "hasChildren": false,
  "groupType": "Organization",
  "accessType": "Restricted"
}

Instead it throws and exception ''cannot read length of undefined" for
obj-traverse.js line 2136: for (var i = 0; i < obj[childrenKey].length; i++) {

I attempted to modify the count

var childCount = (obj[childrenKey]) ? obj[childrenKey].length : 0;
for (var i = 0; i < childCount; i++) {

but it still throws and exception. Any thoughts on what I am doing wrong or a work around?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.