How to use object-keys - 10 common examples

To help you get started, we’ve selected a few object-keys examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stdlib-js / stdlib / lib / node_modules / @stdlib / plot / plot / lib / validate.js View on Github external
'use strict';

// MODULES //

var getKeys = require( 'object-keys' ).shim();
var isObject = require( '@stdlib/utils/is-object' ); // TODO: plain object
var validators = require( './validators' );


// VARIABLES //

var KEYS = getKeys( validators );


// VALIDATE //

/**
* Validates function options.
*
* @private
* @param {Options} options - function options
github stdlib-js / stdlib / lib / node_modules / @stdlib / utils / error-reviver / lib / reviver.js View on Github external
'use strict';

// MODULES //

var getKeys = require( 'object-keys' ).shim();
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
var ctors = require( './ctors.js' );


// MAIN //

/**
* Revives a JSON-serialized error object.
*
* @param {string} key - key
* @param {*} value - value
* @returns {(*|Error|SyntaxError|URIError|EvalError|ReferenceError|RangeError|TypeError)} value or error object
*
* @example
* var str = '{"type":"TypeError","message":"beep"}';
* var err = JSON.parse( str, reviver );
github matthewwithanm / react-controllables / src / index.js View on Github external
return function(...args) {
      // Calculate the new state.
      const currentProps = merge(this.state, omitDefaults(this.props), this.boundActionCreators);
      const newState = reducer(currentProps, ...args);

      // Update the state.
      this.setState(newState);

      // If there are callbacks for the changed values, invoke them.
      keys(newState).forEach(prop => {
        const newValue = newState[prop];
        const callbackName = toCallbackName(prop);
        const cb = this.props[callbackName];
        if (cb) cb(newValue);
      });
    };
  });
github stdlib-js / stdlib / lib / node_modules / @stdlib / math / base / dists / invgamma / examples / index.js View on Github external
* 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';

var getKeys = require( 'object-keys' ).shim();
var invgamma = require( './../lib' );

console.log( getKeys( invgamma ) );
github stdlib-js / stdlib / lib / node_modules / @stdlib / math / base / dists / lognormal / examples / index.js View on Github external
* 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';

var getKeys = require( 'object-keys' ).shim();
var lognormal = require( './../lib' );

console.log( getKeys( lognormal ) );
github stdlib-js / stdlib / lib / node_modules / @stdlib / math / base / dists / hypergeometric / examples / index.js View on Github external
* 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';

var getKeys = require( 'object-keys' ).shim();
var hypergeometric = require( './../lib' );

console.log( getKeys( hypergeometric ) );
github stdlib-js / stdlib / lib / node_modules / @stdlib / math / base / dists / t / examples / index.js View on Github external
* 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';

var getKeys = require( 'object-keys' ).shim();
var t = require( './../lib' );

console.log( getKeys( t ) );
github stdlib-js / stdlib / lib / node_modules / @stdlib / math / base / dists / binomial / examples / index.js View on Github external
* 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';

var getKeys = require( 'object-keys' ).shim();
var binomial = require( './../lib' );

console.log( getKeys( binomial ) );
github stdlib-js / stdlib / lib / node_modules / @stdlib / math / base / dists / cosine / examples / index.js View on Github external
* 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';

var getKeys = require( 'object-keys' ).shim();
var cosine = require( './../lib' );

console.log( getKeys( cosine ) );
github stdlib-js / stdlib / lib / node_modules / @stdlib / math / base / dists / gumbel / examples / index.js View on Github external
* 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';

var getKeys = require( 'object-keys' ).shim();
var gumbel = require( './../lib' );

console.log( getKeys( gumbel ) );

object-keys

An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim

MIT
Latest version published 6 years ago

Package Health Score

67 / 100
Full package analysis

Popular object-keys functions