New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rubyisms

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rubyisms - npm Package Compare versions

Comparing version 0.1.6 to 0.2.0

test/arrays.js

14

package.json
{
"name": "rubyisms",
"version": "0.1.6",
"version": "0.2.0",
"description": "Prototype extensions.",

@@ -11,6 +11,14 @@ "main": "rubyisms.js",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "npm run test-arrays && npm run test-numbers && npm run test-objects && npm run test-strings",
"test-arrays": "mocha test/arrays.js",
"test-numbers": "mocha test/numbers.js",
"test-objects": "mocha test/objects.js",
"test-strings": "mocha test/strings.js"
},
"author": "Colin Hall-Coates <yo@oka.io> (http://oka.io)",
"license": "MIT"
"license": "MIT",
"devDependencies": {
"chai": "^3.0.0",
"mocha": "^2.2.5"
}
}
# Rubyisms
Prototype extensions.

@@ -15,3 +15,3 @@ // Colin 'Oka' Hall-Coates

function $(g, s) {return {get: g, set: s};}
def(SP, {

@@ -67,2 +67,5 @@ capitalize: $(function () {

}),
func: $(function () {
return typeof this === 'function';
}),
numeric: $(function () {

@@ -75,7 +78,10 @@ return typeof this === 'number' && this === this;

size: $(function () {
if (Array.isArray(this) || typeof this === 'string') return this.length;
if (Array.isArray(this) ||
typeof this === 'string' ||
typeof this === 'function') return this.length;
else if (typeof this === 'object') return Object.keys(this).length;
else if (typeof this === 'number' && this === this) return this;
}),
string: $(function () {
return typeof this === 'string';
return typeof this === 'string' || this instanceof String;
})

@@ -95,6 +101,11 @@ });

integer: $(function () {
return this.toFixed() == this;
return this.toFixed() == this && this !== Infinity;
}),
polar: $(function () {
return [Math.abs(this), (this > 0 ? 0 : Math.PI)];
return (isFinite(this) &&
[Math.abs(this), (this < 0 ? Math.PI : 0)]) ||
undefined;
}),
round: $(function () {
return Math.round(this);
})

@@ -105,5 +116,2 @@ });

_p: SP,
eql: function (o) {
return this === o;
},
prepend: function (o) {

@@ -159,7 +167,3 @@ return o + this;

var _Object = {
_p: OP
};
var _Number = {
_p: NP,
_p: OP,
eql: function (o) {

@@ -170,2 +174,6 @@ return this === o;

var _Number = {
_p: NP
};
function buildPrototypes(e) {

@@ -172,0 +180,0 @@ for (var k in e) {

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