Code Monkey home page Code Monkey logo

Comments (11)

matteodelabre avatar matteodelabre commented on June 16, 2024 1

Should be fixed in version 3.0.1, thanks for your help. :)

from mongoose-beautiful-unique-validation.

nicksellen avatar nicksellen commented on June 16, 2024 1

Added breaking test PR #21

from mongoose-beautiful-unique-validation.

nicksellen avatar nicksellen commented on June 16, 2024 1

Super, thanks! Looks good to me here.

from mongoose-beautiful-unique-validation.

matteodelabre avatar matteodelabre commented on June 16, 2024

Hi @koppert, using MongoDB v3.2.7 and Mongoose v4.5.1 the tests are passing correctly. Could you provide the piece of code that triggers this error? Thanks for your help. :)

from mongoose-beautiful-unique-validation.

nicksellen avatar nicksellen commented on June 16, 2024

It's when rawValues has a space in it the regex does not match:

: "ab", matches
: "a b", does not match

The regex in question is /\s*:\s*(\S*),/g

My stacktrace is:

rawValues=: "Tag label",
TypeError: Cannot read property '1' of null
    at /code/trustroots/node_modules/mongoose-beautiful-unique-validation/index.js:92:55
    at Array.forEach (native)
    at /code/trustroots/node_modules/mongoose-beautiful-unique-validation/index.js:90:19
    at tryCallOne (/code/trustroots/node_modules/promise/lib/core.js:37:12)
    at /code/trustroots/node_modules/promise/lib/core.js:123:15
    at flush (/code/trustroots/node_modules/asap/raw.js:50:29)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

from mongoose-beautiful-unique-validation.

nicksellen avatar nicksellen commented on June 16, 2024

Added breaking test here #18

from mongoose-beautiful-unique-validation.

nicksellen avatar nicksellen commented on June 16, 2024

... actually that breaks on a different line: https://travis-ci.org/matteodelabre/mongoose-beautiful-unique-validation/jobs/144058001#L623 .. but I think you get the idea

TypeError: Cannot read property '1' of null
    at beautify (/home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/index.js:61:24)
    at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/index.js:180:21
    at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/node_modules/mongoose/lib/model.js:3331:16
    at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/node_modules/mongoose/lib/model.js:188:9
    at /home/travis/build/matteodelabre/mongoose-beautiful-unique-validation/node_modules/kareem/index.js:127:16
    at doNTCallback0 (node.js:430:9)
    at process._tickCallback (node.js:359:13)

from mongoose-beautiful-unique-validation.

koppert avatar koppert commented on June 16, 2024

Sorry for the lack of feedback. The problem is in space, really.

from mongoose-beautiful-unique-validation.

nicksellen avatar nicksellen commented on June 16, 2024

It's fixed when the keys contain spaces, but not for when the values do. There were two causes of the same error message.

from mongoose-beautiful-unique-validation.

matteodelabre avatar matteodelabre commented on June 16, 2024

I overlooked that a bit indeed. Thanks for the heads up!

from mongoose-beautiful-unique-validation.

matteodelabre avatar matteodelabre commented on June 16, 2024

Should be fixed in version 3.0.2. Value parsing is a bit less hacky and uses JSON.parse.

from mongoose-beautiful-unique-validation.

Related Issues (20)

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.