buryjs

Ruby-like methods for JavaScript.

Usage no npm install needed!

<script type="module">
  import buryjs from 'https://cdn.skypack.dev/buryjs';
</script>

README

Bury.js

npm MIT License code size npm Open in Visual Studio Code

v0.6

Ruby-like methods for JavaScript.

Bury.js extends the prototype of native JS objects such as String, Number and Array.

Example

[3, 3, 4, null].compact.uniq.sum // => 7
[1, 2, 3, 4].append(5).last // => 5
"Hello!".upcase.chop.reverse // => "OLLEH"
"Bury.js".gsub(/\./, '').size // => 6
3.5.floor.next // => 4
3..times(n => alert(n)) // => Try it out!

💡 View more example 💡

Getting Started

npm i buryjs
# or
yarn add buryjs
import Bury from 'buryjs';

Bury.init(options);

If not specified, the options will be set as follows:

options = {
  configurable: true,
  enumerable: false
};

You can also use the Bury methods only for a specific type of prototype by specifying an array for 'options.only' as follows:

Bury.init({
  only: [Array, String]
});

Note: All of Bury's destructive methods will be changed to non-destructive methods in a future version.