Browse Source

chore: updates readme

e22m4u 1 year ago
parent
commit
15868be366
2 changed files with 38 additions and 2 deletions
  1. 19 1
      README-ru.md
  2. 19 1
      README.md

+ 19 - 1
README-ru.md

@@ -17,7 +17,9 @@
 npm install @e22m4u/js-format
 ```
 
-## Примеры
+## Импорт
+
+Модуль поддерживает ESM и CommonJS стандарты.
 
 ESM
 
@@ -31,6 +33,22 @@ CommonJS
 const {format} = require('@e22m4u/js-format');
 ```
 
+## Обзор
+
+Метод `format` возвращает отформатированную строку, используя
+первый аргумент как *printf*-подобный шаблон, который может
+содержать ноль или более спецификаторов. Каждый спецификатор
+заменяется преобразованным значением из соответствующего
+аргумента.
+
+| specifier | description                                  |
+|-----------|----------------------------------------------|
+| `%s`      | использует `String` для конвертации значения |
+| `%d`      | использует `Number` для конвертации значения |
+| `%j`      | представление значения в виде JSON           |
+| `%v`      | см. ниже                                     |
+| `%l`      | см. ниже                                     |
+
 ### %v
 
 Строки оборачиваются в кавычки, остальные примитивы приводятся

+ 19 - 1
README.md

@@ -17,7 +17,9 @@ Additionally:
 npm install @e22m4u/js-format
 ```
 
-## Examples
+## Import
+
+The module supports ESM and CommonJS standard.
 
 ESM
 
@@ -31,6 +33,22 @@ CommonJS
 const {format} = require('@e22m4u/js-format');
 ```
 
+## Overview
+
+The `format` method returns a formatted string using
+the first argument as a printf-like template which can
+contain zero or more format specifiers. Each specifier
+is replaced with the converted value from the corresponding
+argument.
+
+| specifier | description                              |
+|-----------|------------------------------------------|
+| `%s`      | `String` will be used to convert a value |
+| `%d`      | `Number` will be used to convert a value |
+| `%j`      | JSON representation                      |
+| `%v`      | see below                                |
+| `%l`      | see below                                |
+
 ### %v
 
 Strings are wrapped in quotes, other primitives are converted