Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@youngbeen/es-halfmoon

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

@youngbeen/es-halfmoon - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+5
.babelrc
{
"presets": [
"@babel/preset-env"
]
}
+16
-6

@@ -0,3 +1,11 @@

"use strict";
var isString = function isString(val) {
return typeof val === 'string';
};
if (!Array.prototype.get) {
Array.prototype.get = function (property, keyName = '') {
Array.prototype.get = function (property) {
var keyName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
// console.log(property, keyName)

@@ -9,7 +17,7 @@ if (property && isString(property)) {

const sampleItem = this[0];
var sampleItem = this[0];
if (isObject(sampleItem)) {
// object item
const keys = Object.keys(sampleItem);
var keys = Object.keys(sampleItem);

@@ -32,3 +40,5 @@ if (!keyName) {

return this.find(item => item[keyName] === property);
return this.find(function (item) {
return item[keyName] === property;
});
} else {

@@ -54,4 +64,4 @@ // value item

for (let index = this.length - 1; index >= 0; index--) {
const element = this[index];
for (var index = this.length - 1; index >= 0; index--) {
var element = this[index];
callbackfn(element, index);

@@ -58,0 +68,0 @@ }

{
"name": "@youngbeen/es-halfmoon",
"version": "0.1.0",
"version": "0.1.1",
"description": "`ES-halfmoon` is about to provide some prototype methods for ES not covered yet",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

const isString = (val) => {
return typeof (val) === 'string'
}
if (!Array.prototype.get) {

@@ -3,0 +7,0 @@ Array.prototype.get = function (property, keyName = '') {