Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.match is not a function #735

Open
MrShadow50 opened this issue Aug 9, 2024 · 0 comments
Open

v.match is not a function #735

MrShadow50 opened this issue Aug 9, 2024 · 0 comments
Labels

Comments

@MrShadow50
Copy link

The function below is fixed and merged in the v5.x branch but wasn't released for loopback3. Is there a specific version which support loopback3 and have this fix.

function isObjectIDProperty(modelCtor, propDef, value, options) {
  if (!propDef) return false;

  if ((typeof value === 'string' && value.match(ObjectIdValueRegex)) ||
    (Array.isArray(value) && value.every((v) => v.match(ObjectIdValueRegex)))) {
    if (isStoredAsObjectID(propDef)) return true;
    else return !isStrictObjectIDCoercionEnabled(modelCtor, options);
  } else if (value instanceof mongodb.ObjectID) {
    return true;
  } else {
    return false;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant