Giter Club home page Giter Club logo

data-store's Issues

SyntaxError: Invalid regular expression on line 392

https://github.com/jonschlinkert/data-store/blob/master/index.js#L392

This line:

const split = str => str.split(/(?<!\\)\./).map(strip);

Throws an error:

/redacted_path/node_modules/data-store/index.js:392
const split = str => str.split(/(?<!\\)\./).map(strip);
                         ^

SyntaxError: Invalid regular expression: /(?<!\\)\./: Invalid group
    at split (/redacted_path/node_modules/data-store/index.js:392:26)
    at get (/redacted_path/node_modules/data-store/index.js:433:7)
    at Store.has (/redacted_path/node_modules/data-store/index.js:148:19)
    at /redacted_path/redacted_file.js:10:15
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/redacted_path/redacted_file.js:9:11)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)

Changed it to:

const split = str => str.split(/(?!\\)\./).map(strip);

And it hasn't errored yet. I don't know if my fix will break anything though.

Store is not persisting

Hi, im using this package to create a discord bot i want to save the id's of all the pepole in a server, and assign a value to each of them, there are 6800 users in the server, and store is not persisting, even if i use, store.save(); im using heroku to have my bot, and i created a folder and set the cwd there. But still dosn't work, what im doing wrong?

Data-store wont save anything.

I used data-store for a while now, and it worked well until i tried to store something from another folder, it just wont save no matter if i use .load() or .save(), the thing is sometimes it saves sometimes it doesn't and i checked its not because of my code. Ive double checked, the path is correct

Retrieving data-store

Hi, is there a feature that allows you retrieve data set into the store from another js file? Or can you only read data set into the store from the same file.

How to pass a variable as key

I have a variable name 'symbol' which content crypto's symbol (Exp: DIA)
But when I use ${symbol} an error 'Property assignment expected' appears. Here is my code:

store.set(`${id_user}`, {
      `${symbol}`: {
        price_set: ctx.state.price_set,
        percent: ctx.state.percent,
        status: ctx.state.status
      }
    }
); 

What I should do to have data in JSON file storage like below???

{
  "844827665": {
    "DIA": {
      "price_set": 1.8223378037209135,
      "percent": "10",
      "status": "up"
    }
  }
}

Tks for reading my issue. Have a good day, sir

TypeError: Class constructor Store cannot be invoked without 'new'

If I include a store as follows I get a Type Error about the class constructor (node v8.12)

const store = require('data-store')('my-store')
// TypeError: Class constructor Store cannot be invoked without 'new'

const Store = require('data-store')
const store = new Store('my-store')
// works

Maybe it would be best to export a function instead of the class?

module.exports = function(name, options, defaults) {
  return new Store(name, options, defaults)
}

store.set() key with dot dymbol

hi,

i am trying to store with a key containing a dot mark, something like this:
users.set('a.b', 'c')

but in the store the key is separated, like this:
"a": { "b": "c" }
can someone please explain me the right way to get my key not separated?

thankes

has-own-deep instead of has-value

Because .has won't return true when dot notation is used if key value is null or undefined value on the data store and that values are possible case for stores/DBs/etc.

Does store.load() delete the data?

code snippet:

if (!store.hasOwn('players')) {
    store.set('players', []);
  }
  store.load();
  let players = store.get('players');
  let timer = null;
  let cnt = (players.length > 0);

see: #25

How can stored values be updated?

Am I correct in thinking that .get() just returns the values stored in memory? If there is two separate instances of your store, how do you update them to the values stored in the file? Seems like I have to create a new instance of the store right before I run .get().

Inconsistency of undefined

Given the case I call store.set with no value, the key-value pair will be removed from the json file but will remain as key-undefined in memory. Hence Object.keys remains to contain the key only until the file is being read again.
It would be nice to have this be consistent instead.

Set Cache

Please, it would be great to be possible to re-load the cache, or set it to something, becouse i edit the json file and the cache doesn't get updated.

Data store not reading correctly the file

Previously, I've used the package and it used to work fine but yesterday suddenly data-store wouldn't read all the data in the JSON file. If you log the data, it returns an empty object even if the file has data in it.

Is there any work around for this?

I've tried using debouce: 0 in the parameters when creating the store. I've also tried creating a class that extends Store that every method calls .load() but neither that works.

I would appreciate if it's fixed, I really use this package and is really useful.

Release Notes ?

Please pardon the silly issue, but I'm having trouble finding release notes for data-store, looking to understand the changes in 4.0.0 before I upgrade

Delete object inside array

Hi

I want to delete only one object of the array, like this :

{ bars: [ {bar: 'baz', bar2: 'baz2', } ] }

It is possible?

Thanks!

error while using del method in typescript

I want to remove element from data store and I am using typescript. When i try to delete using del method, I get error

"Property 'del' does not exist on type 'DataStore'.ts(2339)"

Any idea how to get it working?

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.