Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

419
Vistas
What does $ sign at the end of function name indicate?

Here is the code I'm reviewing...

import { Observable } from 'rxjs/Rx';
// reducer
import { playerRegister, PlayerState } from './player';
export function getPlayer$ (state$: Observable<MyAppState>): Observable<PlayerState> {
  return state$.select(state => state.player);
};
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Syntactically, the dollar ($) character has no special meaning in JavaScript identifiers.

It is, however, sometimes used by convention to indicate that a variable holds an Observable or that a function will return an Observable.

over 4 years ago · Santiago Trujillo Denunciar

0

This is a code convention named Finnish Notation, apparently due to the origin of the developer that is attributed for first using it. It's used to indicate the Observable type of a variable or function.

The idea is that an Observable usually represents a stream of multiple Values and a pluralized variable / function name would indicate this. To not be confused with array variables (which are usually also pluralized), the $ character is used instead of the s. When reading the variable, you'd read the $ as an s.

Example

When naming an array, you'll most likely use the proper plural form of a single element's name, as in:

const pets = ['cat', 'dog', 'turtle']

While, if you had an observable that emitted those three values, you'd use:

const pet$ = from(['cat', 'dog', 'turtle']) // read: pets

It's up to you and your team whether you want to use it. I guess there is no explicit consensus as of now, so you can have a long and meaningful argument about it ;-). There are already tslint rules available that allow you to enforce your decision.

over 4 years ago · Santiago Trujillo Denunciar

0

I'm not sure if it's used more widely than within the RxJS community, but within this community it's commonly used to indicate that a variable is a stream (i.e. an Observable) or that a function returns such a stream.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda