Comparing version 1.3.0 to 1.4.0
15
index.js
/** | ||
* @author Stanislav Kalashnik <darkpark.main@gmail.com> | ||
* @license GNU GENERAL PUBLIC LICENSE Version 3 | ||
* @license The MIT License (MIT) | ||
* @copyright Stanislav Kalashnik <darkpark.main@gmail.com> | ||
*/ | ||
/* eslint no-path-concat: 0 */ | ||
'use strict'; | ||
@@ -16,7 +18,2 @@ | ||
* @return {string} result data | ||
* | ||
* @example | ||
* console.log(format('This is a {0}', 'cat')); | ||
* console.log(format('This is a {0} and a {1}', 'cat', 'dog')); | ||
* console.log(format('This is a {0} and a {1} and another {0}', 'cat', 'dog')); | ||
*/ | ||
@@ -27,3 +24,3 @@ module.exports = function ( format ) { | ||
if ( DEBUG ) { | ||
if ( DEVELOP ) { | ||
if ( !format ) { throw new Error(__filename + ': format string is empty'); } | ||
@@ -35,4 +32,4 @@ if ( args.length === 0 ) { throw new Error(__filename + ': no arguments'); } | ||
return format.replace(expr, function ( match, number ) { | ||
return args[number] !== undefined ? args[number] : match; | ||
return args[number] === undefined ? match : args[number]; | ||
}); | ||
}; |
{ | ||
"name": "cjs-format", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "String substitution according to the given format.", | ||
@@ -9,8 +9,15 @@ "author": { | ||
}, | ||
"repository": "cjssdk/format", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cjssdk/format.git" | ||
}, | ||
"scripts": { | ||
"lint": "eslint ./*.js", | ||
"test": "node ./tests/main.js", | ||
"lint": "eslint .", | ||
"test": "npm run lint", | ||
"jsdoc": "jsdoc --destination doc *.js readme.md" | ||
}, | ||
"devDependencies": { | ||
"cjs-eslint-config": "1.*.*", | ||
"eslint": "3.*.*" | ||
}, | ||
"keywords": [ | ||
@@ -24,3 +31,3 @@ "commonjs", | ||
], | ||
"license": "GPL-3.0" | ||
"license": "MIT" | ||
} |
String substitution according to the given format | ||
================================================= | ||
[![Build Status](https://img.shields.io/travis/cjssdk/format.svg?style=flat-square)](https://travis-ci.org/cjssdk/format) | ||
[![NPM version](https://img.shields.io/npm/v/cjs-format.svg?style=flat-square)](https://www.npmjs.com/package/cjs-format) | ||
[![Dependencies Status](https://img.shields.io/david/cjssdk/format.svg?style=flat-square)](https://david-dm.org/cjssdk/format) | ||
[![Gitter](https://img.shields.io/badge/gitter-join%20chat-blue.svg?style=flat-square)](https://gitter.im/DarkPark/cjssdk) | ||
[![RunKit](https://img.shields.io/badge/RunKit-try-yellow.svg?style=flat-square)](https://runkit.com/npm/cjs-format) | ||
@@ -49,5 +51,5 @@ | ||
## Debug mode ## | ||
## Development mode ## | ||
> There is a global var `DEBUG` which activates additional consistency checks and protection logic not available in release mode. | ||
> There is a global var `DEVELOP` which activates additional consistency checks and protection logic not available in release mode. | ||
@@ -63,2 +65,2 @@ | ||
`cjs-format` is released under the [GPL-3.0 License](http://opensource.org/licenses/GPL-3.0). | ||
`cjs-format` is released under the [MIT License](license.md). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
4682
5
0
100
65
0
2
26