Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

A JavaScript Package For Converting Positive Value To negative. Also works when non-numbers are present as well.

License

Notifications You must be signed in to change notification settings

Prosen-Ghosh/to-negative-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

to-negative-array

A JavaScript Package For Converting Positive Value To negative. Also works when non-numbers are present as well.

npm license github-issues stars forks

Features

npm Install

npm install --save to-negative-array

Script Tag

For Development

<script src="https://rawgit.com/Prosen-Ghosh/to-negative-array/master/negative.js"></script>

For Production

<script src="https://cdn.rawgit.com/Prosen-Ghosh/to-negative-array/7d9e5e1c/negative.js"></script>

Usage

const toNegative = require('to-negative-array');

toNegative([]);
//=> null

toNegative([1,2,3,4,5]);
//=> [ -1, -2, -3, -4, -5 ]

toNegative([1,2,3,4,5,{}]);
//=> [ -1, -2, -3, -4, -5, {} ]

toNegative([1,2,3,4,5,{},[]]);
//=> [ -1, -2, -3, -4, -5, {}, [] ]

toNegative([1,2,3,4,5,{},[],""]);
//=> [ -1, -2, -3, -4, -5, {}, [], '' ]

toNegative([1,2,3,4,5,{},[],"",-100]);
//=> [ -1, -2, -3, -4, -5, {}, [], '', -100 ]

toNegative(); // without parameter thid function will throw a type error
//=> TypeError: negative() expects an array parameter

Author

Prosen Ghosh prosenghosh25@gmail.com (https://bd.linkedin.com/in/prosen-ghosh-baba9aa8)

License

  • MIT

About

A JavaScript Package For Converting Positive Value To negative. Also works when non-numbers are present as well.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published