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

doc-title

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doc-title - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

package.json
{
"name": "doc-title",
"version": "1.0.0",
"version": "1.0.1",
"description": "Easily set the documents title",

@@ -16,3 +16,2 @@ "main": "index.js",

"title",
"title",
"alert"

@@ -19,0 +18,0 @@ ],

@@ -8,11 +8,11 @@ # Titler

```javascript
var titler = require('titler');
var title = require('doc-title');
titler.setApp('AppName'); // title is 'AppName'
titler.setPage('Home'); // title is 'AppName | Home'
titler.setModifier('On The Range'); // title is 'AppName | Home | On The Range'
titler.setSeparator(': '); // title is 'AppName: Home: On The Range'
title.setApp('AppName'); // title is 'AppName'
title.setPage('Home'); // title is 'AppName | Home'
title.setModifier('On The Range'); // title is 'AppName | Home | On The Range'
title.setSeparator(': '); // title is 'AppName: Home: On The Range'
titler.flash('Where the deer and the buffalo roam'); // title is 'Where the deer and the buffalo roam' for 5 seconds, then resets
title.flash('Where the deer and the buffalo roam'); // title is 'Where the deer and the buffalo roam' for 5 seconds, then resets
```

@@ -1,11 +0,11 @@

var titler = require('../index');
var title = require('../index');
var assert = require('assert');
var mockDoc = {};
titler.setDocument(mockDoc);
title.setDocument(mockDoc);
describe('Titler', function() {
describe('Doc-title', function() {
describe('Setting the title', function () {
it('Should set the title when changing the app', function () {
titler.setApp('AppName');
title.setApp('AppName');
assert.equal(mockDoc.title, 'AppName');

@@ -15,4 +15,4 @@ });

it('Should set the title when changing the page', function () {
titler.setApp('AppName');
titler.setPage('PageName');
title.setApp('AppName');
title.setPage('PageName');
assert.equal(mockDoc.title, 'AppName | PageName');

@@ -22,5 +22,5 @@ });

it('Should set the title when changing the modifier', function () {
titler.setApp('AppName');
titler.setPage('PageName');
titler.setModifier('Modified');
title.setApp('AppName');
title.setPage('PageName');
title.setModifier('Modified');
assert.equal(mockDoc.title, 'AppName | PageName | Modified');

@@ -30,15 +30,15 @@ });

it('Should set the title when changing the separator', function () {
titler.setApp('AppName');
titler.setPage('PageName');
titler.setModifier('Modified');
titler.setSeparator(' : ');
title.setApp('AppName');
title.setPage('PageName');
title.setModifier('Modified');
title.setSeparator(' : ');
assert.equal(mockDoc.title, 'AppName : PageName : Modified');
titler.setSeparator(' | ');
title.setSeparator(' | ');
});
if ('Should reset modifier when setting page', function () {
titler.setApp('AppName');
titler.setPage('PageName');
titler.setModifier('Modified');
titler.setPage('Other PageName');
title.setApp('AppName');
title.setPage('PageName');
title.setModifier('Modified');
title.setPage('Other PageName');
assert.equal(mockDoc.title, 'AppName | Other PageName');

@@ -48,6 +48,6 @@ });

if ('Should reset page and modifier when changing app name', function () {
titler.setApp('AppName');
titler.setPage('PageName');
titler.setModifier('Modified');
titler.setApp('Other AppName');
title.setApp('AppName');
title.setPage('PageName');
title.setModifier('Modified');
title.setApp('Other AppName');
assert.equal(mockDoc.title, 'Other AppName');

@@ -59,5 +59,5 @@ });

it('Should set the title to the message, then change it back', function (done) {
titler.setApp('AppName');
titler.setMessageTime(4);
titler.flash('Emergency!');
title.setApp('AppName');
title.setMessageTime(4);
title.flash('Emergency!');
assert.equal(mockDoc.title, 'Emergency!');

@@ -64,0 +64,0 @@ setTimeout(function () {

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