forms-angular 0.12.0-beta.206 → 0.12.0-beta.207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -198,11 +198,14 @@ class FormsAngular {
198
198
  addResource(resourceName, model, options) {
199
199
  let resource = {
200
200
  resourceName: resourceName,
201
+ resourceNameLower: resourceName.toLowerCase(),
201
202
  options: options || {}
202
203
  };
203
204
  if (!resource.options.suppressDeprecatedMessage) {
204
205
  console.log('addResource is deprecated - see https://github.com/forms-angular/forms-angular/issues/39');
205
206
  }
207
+ // Check all the synonyms are lower case
208
+ resource.options.synonyms?.forEach(s => { s.name = s.name.toLowerCase(); });
206
209
  if (typeof model === 'function') {
207
210
  resource.model = model;
208
211
  }
@@ -354,7 +357,7 @@ class FormsAngular {
354
357
  }
355
358
  for (let i = 0; i < resourceCount; i++) {
356
359
  let resource = resourcesToSearch[i];
357
- if (resourceCount === 1 || (resource.options.searchImportance !== false && (!collectionName || collectionName === resource.resourceName || resource.options?.synonyms?.find(s => s.name?.toLowerCase() === collectionNameLower)))) {
360
+ if (resourceCount === 1 || (resource.options.searchImportance !== false && (!collectionName || collectionNameLower === resource.resourceNameLower || resource.options?.synonyms?.find(s => s.name === collectionNameLower)))) {
358
361
  let schema = resource.model.schema;
359
362
  let indexedFields = [];
360
363
  for (let j = 0; j < schema._indexes.length; j++) {
@@ -88,6 +88,7 @@ declare module fngServer {
88
88
 
89
89
  interface Resource extends ResourceExport {
90
90
  resourceName: string;
91
+ resourceNameLower: string;
91
92
  }
92
93
 
93
94
  interface ListParams {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mark Chapman <support@forms-angular.org>",
4
4
  "description": "A form builder that sits on top of Angular.js, Twitter Bootstrap, jQuery UI, Angular-UI, Express and Mongoose. Opinionated or what?",
5
5
  "homepage": "http://forms-angular.org",
6
- "version": "0.12.0-beta.206",
6
+ "version": "0.12.0-beta.207",
7
7
  "engines": {
8
8
  "node": ">=8.x",
9
9
  "npm": ">=5.x"