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

pibrary

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

pibrary - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

37

lib/pibrary.js

@@ -1,2 +0,2 @@

"use strict";
'use strict';

@@ -6,2 +6,24 @@ Object.defineProperty(exports, "__esModule", {

});
// HELPER FUNCTIONS
function getMathPIStringNoDecimal() {
// divide by 10 to get decimal on left
var mathPIDivTen = Math.PI / 10;
// convert to string
var mathPIString = '' + mathPIDivTen;
// leave out decimal
return mathPiString.substring(1);
};
function lengthOfMathPI() {
return getMathPIStringNoDecimal().length;
};
function getDigitFromMathPI(index) {
return getMathPIStringNoDecimal.charat(index);
};
// PIBRARY
var pibrary = {};

@@ -13,6 +35,15 @@

pibrary.digitAt = function () {
return 3;
/*
* zero-indexed
* 0 would return 3, 1 would return 1, 2 would return 4, etc
*/
pibrary.digitAt = function (index) {
if (index < lengthOfMathPI()) {
return getDigitFromMathPI(index);
}
// otherwise need to actually calculate digit of pi
return -1;
};
exports.default = pibrary;

2

package.json
{
"name": "pibrary",
"version": "0.0.2",
"version": "0.0.3",
"description": "everything pi",

@@ -5,0 +5,0 @@ "main": "lib/pibrary.js",

@@ -0,1 +1,23 @@

// HELPER FUNCTIONS
function getMathPIStringNoDecimal () {
// divide by 10 to get decimal on left
const mathPIDivTen = Math.PI / 10;
// convert to string
const mathPIString = '' + mathPIDivTen;
// leave out decimal
return mathPiString.substring(1);
};
function lengthOfMathPI () {
return getMathPIStringNoDecimal().length;
};
function getDigitFromMathPI (index) {
return getMathPIStringNoDecimal.charat(index);
};
// PIBRARY
const pibrary = {};

@@ -7,6 +29,15 @@

pibrary.digitAt = function () {
return 3;
/*
* zero-indexed
* 0 would return 3, 1 would return 1, 2 would return 4, etc
*/
pibrary.digitAt = function (index) {
if ( index < lengthOfMathPI() ) {
return getDigitFromMathPI(index);
}
// otherwise need to actually calculate digit of pi
return -1;
};
export default pibrary;
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