<commit_before><!--

@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.

-->

# Define Property

> [Define][define-property] a property.

<section class="usage">

## Usage

```javascript
var defineProperty = require( '@stdlib/utils/define-property' );
```

#### defineProperty( obj, prop, descriptor )

[Defines][define-property] a property.

```javascript
var obj = {};

defineProperty( obj, 'foo', {
    'value': 'bar',
    'writable': false
});

obj.foo = 'boop';
// throws <Error>
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var defineProperty = require( '@stdlib/utils/define-property' );

function Foo( name ) {
    if ( !(this instanceof Foo) ) {
        return new Foo( name );
    }
    defineProperty( this, 'name', {
        'configurable': true
    });
    return this;
}

var foo = new Foo( 'beep' );

try {
    delete foo.name;
    console.log( '`name` property successfully deleted.' );
} catch ( err ) {
    console.error( err.message );
}
```

</section>

<!-- /.examples -->

<section class="links">

[define-property]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

</section>

<!-- /.links --><commit_msg>Update link<commit_after><!--

@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.

-->

# Define Property

> [Define][mdn-define-property] a property.

<section class="usage">

## Usage

```javascript
var defineProperty = require( '@stdlib/utils/define-property' );
```

#### defineProperty( obj, prop, descriptor )

[Defines][mdn-define-property] a property.

```javascript
var obj = {};

defineProperty( obj, 'foo', {
    'value': 'bar',
    'writable': false
});

obj.foo = 'boop';
// throws <Error>
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var defineProperty = require( '@stdlib/utils/define-property' );

function Foo( name ) {
    if ( !(this instanceof Foo) ) {
        return new Foo( name );
    }
    defineProperty( this, 'name', {
        'configurable': true
    });
    return this;
}

var foo = new Foo( 'beep' );

try {
    delete foo.name;
    console.log( '`name` property successfully deleted.' );
} catch ( err ) {
    console.error( err.message );
}
```

</section>

<!-- /.examples -->

<section class="links">

[mdn-define-property]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

</section>

<!-- /.links -->
{'fraction_non_alphanumeric': 0.1507495835646863, 'fraction_numerical': 0.00555247084952804, 'mean_word_length': 3.5781448538754765, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 2, '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': '4438042', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1074, 'n_words': 355}