Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-url-slugs

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-url-slugs - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

9

History.md
# History
## V 1.0.1 (September 19, 2017)
* Fixed a bug which added unnecessary numbers ([ralphnajm](https://github.com/ralphnajm))
## V 1.0.0 (April 18, 2017)
* *BREAKING CHANGES*
* Added alwaysRecreate ((https://github.com/PeterJausovec)PeterJausovec)
* Added alwaysRecreate ([PeterJausovec](https://github.com/PeterJausovec))
* Added undefinedVal option.
* Added additional tests ((https://github.com/phillee)phillee)
* Added additional tests ([phillee](https://github.com/phillee))
## V 0.3.0 (April 18, 2017)
* Added onHook option ((https://github.com/mtimofiiv)mtimofiiv)
* Added onHook option ([mtimofiiv](https://github.com/mtimofiiv))
* Updated dependencies

@@ -12,0 +15,0 @@

@@ -136,3 +136,3 @@ var extend = require('extend');

var schemaField = {};
schemaField[options.field] = {

@@ -147,3 +147,3 @@ type: options.indexType,

};
schema.add(schemaField);

@@ -172,3 +172,3 @@ }

count = docSlug.match(new RegExp((slugLimited ? slug.substr(0, slug.length - 2) : slug) + options.separator + '([0-9]+)$'));
count = ((count instanceof Array) ? parseInt(count[1]) : 0) + 1;
count = ((count instanceof Array) ? parseInt(count[1]) + 1 : 0);
}

@@ -180,3 +180,3 @@ return (count > max) ? count : max;

var suffix = options.separator + max;
var suffix = ((max === 0) ? '' : options.separator + max);

@@ -199,6 +199,6 @@ if (options.maxLength) return cb(null, slug.substr(0, options.maxLength - suffix.length) + suffix);

var slugFieldsModified = doc.isNew;
// Skip if it's an edit and the plugin is configured to not update.
if (!doc.isNew && !options.update && currentSlug) return next();
// Skip if it's an edit and the user explicitly sets a slug and plugin is not configured to always recreate slug.

@@ -227,3 +227,3 @@ else if (!doc.isNew && doc.isModified(options.field) && currentSlug && !options.alwaysRecreate) return next();

var newSlug = options.generator(removeDiacritics(toSlugify), options.separator);
if (options.indexSparse && newSlug === options.undefinedVal) {

@@ -230,0 +230,0 @@ doc.set(options.field, undefined);

@@ -9,3 +9,3 @@ {

"description": "Create URL compatiable slugs on mongoose models, ensuring uniqueness.",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [

@@ -12,0 +12,0 @@ "mongoose slugs",

@@ -94,3 +94,3 @@ [![Build Status](https://travis-ci.org/talha-asad/mongoose-url-slugs.svg?branch=master)](https://travis-ci.org/talha-asad/mongoose-url-slugs)

* **indexSparse** (Default: False) - Mongoose schema slug index sparse value.
* **onHook** (Default: 'validate') - Mongoose document hook to update slug.
* **onHook** (Default: 'validate') - Mongoose document hook to create/update slug.

@@ -97,0 +97,0 @@ ## License

Sorry, the diff of this file is not supported yet

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