diff --git a/.github/.keepalive b/.github/.keepalive new file mode 100644 index 0000000..c3bed46 --- /dev/null +++ b/.github/.keepalive @@ -0,0 +1 @@ +2024-03-01T00:35:15.754Z diff --git a/.npmignore b/.npmignore index 5c7f09d..8eea7dc 100644 --- a/.npmignore +++ b/.npmignore @@ -29,8 +29,9 @@ branches.md .postinstall.json Makefile -# Ignore `binding.gyp` file to avoid compilation of native addon when installing package: +# Ignore files to avoid compilation of native addon when installing package: binding.gyp +include.gypi # Directories # ############### diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 726c1ec..6a1c080 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2,17 +2,22 @@ # # Contributors listed in alphabetical order. +Aditya Sapra <110766802+adityacodes30@users.noreply.github.com> +AgPriyanshu18 <113460573+AgPriyanshu18@users.noreply.github.com> Ali Salesi Amit Jimiwal Athan Reines Brendan Graetz Bruno Fenzl +Chinmay J <86140365+JawHawk@users.noreply.github.com> Christopher Dambamuromo Dan Rose Daniel Killenberger Dominik Moritz Dorrin Sotoudeh Frank Kovacs +GUNJ JOSHI +Golden <103646877+AuenKr@users.noreply.github.com> Harshita Kalani James Gelok Jaysukh Makvana @@ -21,21 +26,31 @@ Joey Reed Jordan Gallivan <115050475+Jordan-Gallivan@users.noreply.github.com> Joris Labie Justin Dennison +Karthik Prakash <116057817+skoriop@users.noreply.github.com> +Khaldon Marcus Fantham Matt Cochrane +Mihir Pandit <129577900+MSP20086@users.noreply.github.com> Milan Raj Momtchil Momtchev Naresh Jagadeesan Nithin Katta <88046362+nithinkatta@users.noreply.github.com> Ognjen Jevremović Philipp Burckhardt +Prajwal Kulkarni Pranav Goswami +Praneki <97080887+PraneGIT@users.noreply.github.com> +Pratik <97464067+Pratik772846@users.noreply.github.com> Ricky Reusser Robert Gislason Roman Stetsyk <25715951+romanstetsyk@users.noreply.github.com> +Rutam <138517416+performant23@users.noreply.github.com> Ryan Seal Seyyed Parsa Neshaei Shraddheya Shendre +Shubham +Snehil Shah <130062020+Snehil-Shah@users.noreply.github.com> +Spandan Barve <114365550+marsian83@users.noreply.github.com> Stephannie Jiménez Gacha Yernar Yergaziyev orimiles5 <97595296+orimiles5@users.noreply.github.com> diff --git a/README.md b/README.md index 069b11a..196e6f9 100644 --- a/README.md +++ b/README.md @@ -175,11 +175,6 @@ For more information on the project, filing bug reports and feature requests, an --- -## License - -See [LICENSE][stdlib-license]. - - ## Copyright Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. @@ -195,8 +190,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [npm-image]: http://img.shields.io/npm/v/@stdlib/utils-define-nonenumerable-read-only-accessor.svg [npm-url]: https://npmjs.org/package/@stdlib/utils-define-nonenumerable-read-only-accessor -[test-image]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-accessor/actions/workflows/test.yml/badge.svg?branch=v0.2.2 -[test-url]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-accessor/actions/workflows/test.yml?query=branch:v0.2.2 +[test-image]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-accessor/actions/workflows/test.yml/badge.svg?branch=main +[test-url]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-accessor/actions/workflows/test.yml?query=branch:main [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/utils-define-nonenumerable-read-only-accessor/main.svg [coverage-url]: https://codecov.io/github/stdlib-js/utils-define-nonenumerable-read-only-accessor?branch=main @@ -226,8 +221,6 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [esm-readme]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-accessor/blob/esm/README.md [branches-url]: https://github.com/stdlib-js/utils-define-nonenumerable-read-only-accessor/blob/main/branches.md -[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-define-nonenumerable-read-only-accessor/main/LICENSE - [@stdlib/utils/define-property]: https://github.com/stdlib-js/utils-define-property diff --git a/dist/index.js b/dist/index.js index d5d32f6..886b56e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,35 @@ -"use strict";var n=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var t=n(function(l,s){ -var i=require('@stdlib/utils-define-property/dist');function u(r,e,a){i(r,e,{configurable:!1,enumerable:!1,get:a})}s.exports=u -});var o=t();module.exports=o; /** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map + +'use strict'; + +/** +* Define a non-enumerable read-only accessor. +* +* @module @stdlib/utils-define-nonenumerable-read-only-accessor +* +* @example +* var setNonEnumerableReadOnlyAccessor = require( '@stdlib/utils-define-nonenumerable-read-only-accessor' ); +* +* function getter() { +* return 'bar'; +* } +* +* var obj = {}; +* +* setNonEnumerableReadOnlyAccessor( obj, 'foo', getter ); +* +* try { +* obj.foo = 'boop'; +* } catch ( err ) { +* console.error( err.message ); +* } +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/dist/main.js b/dist/main.js new file mode 100644 index 0000000..ab26de7 --- /dev/null +++ b/dist/main.js @@ -0,0 +1,61 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2018 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var defineProperty = require( '@stdlib/utils-define-property' ); + + +// MAIN // + +/** +* Defines a non-enumerable read-only accessor. +* +* @param {Object} obj - object on which to define the property +* @param {(string|symbol)} prop - property name +* @param {Function} getter - accessor +* +* @example +* function getter() { +* return 'bar'; +* } +* +* var obj = {}; +* +* setNonEnumerableReadOnlyAccessor( obj, 'foo', getter ); +* +* try { +* obj.foo = 'boop'; +* } catch ( err ) { +* console.error( err.message ); +* } +*/ +function setNonEnumerableReadOnlyAccessor( obj, prop, getter ) { // eslint-disable-line id-length + defineProperty( obj, prop, { + 'configurable': false, + 'enumerable': false, + 'get': getter + }); +} + + +// EXPORTS // + +module.exports = setNonEnumerableReadOnlyAccessor; diff --git a/package.json b/package.json index 79eb5bc..a670a4e 100644 --- a/package.json +++ b/package.json @@ -38,16 +38,16 @@ }, "dependencies": { "@stdlib/types": "^0.3.2", - "@stdlib/utils-define-property": "^0.2.1" + "@stdlib/utils-define-property": "^0.2.3" }, "devDependencies": { - "@stdlib/assert-is-string": "^0.2.0", - "@stdlib/string-from-code-point": "^0.2.0", - "@stdlib/utils-keys": "^0.2.0", + "@stdlib/assert-is-string": "^0.2.1", + "@stdlib/string-from-code-point": "^0.2.1", + "@stdlib/utils-keys": "^0.2.1", "tape": "git+https://github.com/kgryte/tape.git#fix/globby", "istanbul": "^0.4.1", "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.0" + "@stdlib/bench-harness": "^0.2.1" }, "engines": { "node": ">=0.10.0",