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

cjs-format

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

cjs-format - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

license.md

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];
});
};

17

package.json
{
"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

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