All Projects → words → ap-style-title-case

words / ap-style-title-case

Licence: MIT license
Convert a value to AP/APA title case

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ap-style-title-case

styles
Styles for The Carpentries lessons. No README to avoid merge conflicts with lessons. Demo 👇
Stars: ✭ 72 (+111.76%)
Mutual labels:  english
grammarly-editor
Purify Grammarly editing experience
Stars: ✭ 16 (-52.94%)
Mutual labels:  english
case-converter
Convert strings between 13 naming conventions: Snake case, Camel case, Kebab case, Pascal case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Title case, Sentence case and Dot notation.
Stars: ✭ 148 (+335.29%)
Mutual labels:  title-case
Semantic-Textual-Similarity
Natural Language Processing using NLTK and Spacy
Stars: ✭ 30 (-11.76%)
Mutual labels:  english
NewConceptEnglish
English for Chinese, 新概念英语笔记,英语学习资料
Stars: ✭ 121 (+255.88%)
Mutual labels:  english
geospatial-python
Introduction to Geospatial Raster and Vector Data with Python
Stars: ✭ 107 (+214.71%)
Mutual labels:  english
KanColle-English-Patch-KCCP
English Patch for the original KanColle browser game, to be used with KCCacheProxy. Translates most of the game into english.
Stars: ✭ 28 (-17.65%)
Mutual labels:  english
docker-introduction
Reproducible Computational Environments using Containers
Stars: ✭ 34 (+0%)
Mutual labels:  english
subtlex-word-frequencies
A list of words from the SUBTLEX movie subtitles corpus, sorted by frequency.
Stars: ✭ 25 (-26.47%)
Mutual labels:  english
python-packaging-publishing
Packaging and Publishing with Python
Stars: ✭ 24 (-29.41%)
Mutual labels:  english
nim-presentation-slides
Nim Presentation Slides and Examples.
Stars: ✭ 30 (-11.76%)
Mutual labels:  english
EnglishStu
英语学习软件,集成有道翻译、科大讯飞,有翻译、朗读示例、阅读评测功能
Stars: ✭ 27 (-20.59%)
Mutual labels:  english
sql-ecology-lesson
Data Management with SQL for Ecologists
Stars: ✭ 37 (+8.82%)
Mutual labels:  english
say-it
TTS in command line -- Pronounce the Chinese and English words you typed in.
Stars: ✭ 19 (-44.12%)
Mutual labels:  english
almanca
Almanca dilbilgisi ve gramer notlari / Lesson notes I have taken to learn the German language beginning from A1.
Stars: ✭ 15 (-55.88%)
Mutual labels:  english
iris
Repositório oficial da BOT Íris, uma robô em português, inglês e espanhol para WhatsApp [Com MD/Sem MD], possui centenas de comandos diferentes, a lista vai de fazer stickers a jogar xadrez ou blackjack.
Stars: ✭ 166 (+388.24%)
Mutual labels:  english
r-novice-inflammation
Programming with R
Stars: ✭ 142 (+317.65%)
Mutual labels:  english
arXiv-title-fixer
📃 Set the correct (tab) titles for your arXiv papers containing tabs.
Stars: ✭ 41 (+20.59%)
Mutual labels:  title
sql-novice-survey
Databases and SQL
Stars: ✭ 59 (+73.53%)
Mutual labels:  english
deep-learning-intro
Learn Deep Learning with Python
Stars: ✭ 23 (-32.35%)
Mutual labels:  english

ap-style-title-case

Build Coverage Downloads Size

Convert a value to AP/APA title case.

Contents

What is this?

This small package turns a sentence into title case.

When should I use this?

You can use this when you have short text of unknown casing and want to display it in a heading or so.

Install

This package is ESM only. In Node.js (version 14.14+, 16.0+), install with npm:

npm install ap-style-title-case

In Deno with esm.sh:

import {apStyleTitleCase} from 'https://esm.sh/ap-style-title-case@2'

In browsers with esm.sh:

<script type="module">
  import {apStyleTitleCase} from 'https://esm.sh/ap-style-title-case@2?bundle'
</script>

Use

import {apStyleTitleCase} from 'ap-style-title-case'

console.log(apStyleTitleCase('why sunless tanning is A hot trend'))
// 'Why Sunless Tanning Is a Hot Trend'

API

apStyleTitleCase(value[, options])

Convert a value (string) to title case (string) using AP/APA style.

options

Configuration (optional).

options.keepSpaces

Keep superfluous whitespace (boolean, default: false). Whitespace is turned into a space by default.

options.stopwords

List of stopwords (Array<string>, default: see below). When a lowercased word is included in this list, it will be used as lowercase. Otherwise words are capitalized.

Algorithm

  • always capitalize the first word, even if it’s a stop word
  • always capitalize the last word, even if it’s a stop word
  • lowercase these words: a, an, and, at, but, by, for, in, nor, of, on, or, so, the, to, up, yet

Many writers make the error of leaving to be verbs in lower case. Even though is, are, was, and be, are all short words, they should still be capitalized in a title because they are verbs.

When you write titles that contain prepositions, your word processor will likely tell you that you should leave words like with, about, and around lowercase. Defiantly look past the squiggly line indicating a potential error, and remember that in AP title case, prepositions with four or more letters should be capitalized.

These rules are the exact same for APA style, the only difference being that AP style does not recommend the use of title case for newspaper headlines, but rather sentence case.

References

Types

This package is fully typed with TypeScript. It exports the additional type Options.

Compatibility

This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 14.14+ and 16.0+. It also works in Deno and modern browsers.

Contribute

Yes please! See How to Contribute to Open Source.

Security

This package is safe.

License

MIT © Zeke Sikelianos

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].