<commit_before>orcorum [![NPM Version](https://img.shields.io/npm/v/orcorum.svg?style=flat)](https://www.npmjs.com/package/orcorum)
=======

Helper library for JavaScript

## API

### orcorum.classes

#### extend(properties, [statics])

To create a class of your own base class, you extend your base class and provide instance properties, as well as optional statics to be attached directly to the constructor function.

```javascript
function Animal(name) {
    this.name = name;
}

Animal.prototype.getName = function() {
    return this.name;
};

Animal.extend = orcorum.classes.extend;

// ...

var Dog = Animal.extend({
    bark: function() {
        return 'GUAUUU!!!'
    }
});

var dog = new Dog('pepito');

console.log(dog.name); // => pepito

console.log(dog.bark()); // => GUAUUU!!!
```

### orcorum.object

#### get(target, keys, [defaultValue])

Get property of target.

```javascript
orcorum.object.get({
    name: 'pepito',
    age: 3
}, 'age'); // => 3

orcorum.object.get({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, ['name', 'first']); // => pepito

orcorum.object.get({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, ['name', 'alias'], 'pepe'); // => pepe

orcorum.object.get({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, ['works', 'first', 'beginDate']); // => undefined
```

#### extend(target, *sources)

Override properties of target with the all properties in the source objects (in-order), and return the target object.

```javascript
orcorum.object.extend({
    name: 'pepito',
    age: 3
}, {
    age: 4
}); // => {name: 'pepito', age: 4}

orcorum.object.extend({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, {
    name: {
        last: 'robin'
    }
}); // => {name: {first: 'pepito', last: 'robin'}, age: 3}
```

### orcorum.url

#### normalize(url)<commit_msg>Add string utilities<commit_after>orcorum [![NPM Version](https://img.shields.io/npm/v/orcorum.svg?style=flat)](https://www.npmjs.com/package/orcorum)
=======

Helper library for JavaScript

## API

### orcorum.classes

#### extend(properties, [statics])

To create a class of your own base class, you extend your base class and provide instance properties, as well as optional statics to be attached directly to the constructor function.

```javascript
function Animal(name) {
    this.name = name;
}

Animal.prototype.getName = function() {
    return this.name;
};

Animal.extend = orcorum.classes.extend;

// ...

var Dog = Animal.extend({
    bark: function() {
        return 'GUAUUU!!!'
    }
});

var dog = new Dog('pepito');

console.log(dog.name); // => pepito

console.log(dog.bark()); // => GUAUUU!!!
```

### orcorum.object

#### get(target, keys, [defaultValue])

Get property of target.

```javascript
orcorum.object.get({
    name: 'pepito',
    age: 3
}, 'age'); // => 3

orcorum.object.get({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, ['name', 'first']); // => pepito

orcorum.object.get({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, ['name', 'alias'], 'pepe'); // => pepe

orcorum.object.get({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, ['works', 'first', 'beginDate']); // => undefined
```

#### extend(target, *sources)

Override properties of target with the all properties in the source objects (in-order), and return the target object.

```javascript
orcorum.object.extend({
    name: 'pepito',
    age: 3
}, {
    age: 4
}); // => {name: 'pepito', age: 4}

orcorum.object.extend({
    name: {
        first: 'pepito',
        last: 'roman'
    },
    age: 3
}, {
    name: {
        last: 'robin'
    }
}); // => {name: {first: 'pepito', last: 'robin'}, age: 3}
```

### orcorum.string

#### startsWith(str, starts)

Checks whether the `str` begins with `starts`.

```javascript
console.log(orcorum.string.startsWith('/path/to', '/')); // => true
console.log(orcorum.string.startsWith('/path/to', '/path')); // => true
console.log(orcorum.string.startsWith('/path/to', '/to')); // => false
```

#### endsWith(str, ends)

Checks whether the `str` ends with `ends`.

```javascript
console.log(orcorum.string.endsWith('/path/to', 'o')); // => true
console.log(orcorum.string.endsWith('/path/to', '/to')); // => true
console.log(orcorum.string.endsWith('/path/to', '/path')); // => false
```

### orcorum.url

#### normalize(url)
{'fraction_non_alphanumeric': 0.20240480961923848, 'fraction_numerical': 0.00445335114673792, 'mean_word_length': 3.0541516245487363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3646235', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1564, 'n_words': 381}