New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-keywords

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-keywords - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

17

dist/index.js

@@ -24,10 +24,9 @@ 'use strict';

var keywordsPlugin = function keywordsPlugin(schema) {
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
paths = _ref.paths,
_ref$field = _ref.field,
field = _ref$field === undefined ? 'keywords' : _ref$field,
_ref$transform = _ref.transform,
transform = _ref$transform === undefined ? normalize : _ref$transform;
var paths = _ref.paths;
var _ref$field = _ref.field;
var field = _ref$field === undefined ? 'keywords' : _ref$field;
var _ref$transform = _ref.transform;
var transform = _ref$transform === undefined ? normalize : _ref$transform;
paths = paths && paths.map(function (p) {

@@ -39,6 +38,6 @@ return schema.path(p);

schema.add(_defineProperty({}, field, {
schema.add(_defineProperty({}, field, _lodash2.default.assign({}, schema.tree[field], {
type: [String],
index: true
}));
})));

@@ -45,0 +44,0 @@ paths.forEach(function (path) {

{
"name": "mongoose-keywords",
"version": "0.3.1",
"version": "0.3.2",
"description": "Mongoose plugin that recursively generates keywords for documents based on its fields",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -38,4 +38,2 @@ # mongoose-keywords

```js
var mongoose = require('mongoose');
var ArtistSchema = new mongoose.Schema({

@@ -54,6 +52,18 @@ name: String,

### Custom `keywords` path options
You can still define a `keywords` path on your schema with predefined options.
```js
var ArtistSchema = new mongoose.Schema({
name: String,
keywords: {
type: [String],
unique: true // new custom option
}
});
ArtistSchema.plugin(require('mongoose-keywords'), {paths: ['name']});
```
### Custom `keywords` field
```js
var mongoose = require('mongoose');
var ArtistSchema = new mongoose.Schema({

@@ -60,0 +70,0 @@ name: String

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc